A long time back, I made a simple program that will register Mozilla Firefox Portable with Default Programs or Default Apps in Windows. Many users asked if a tool can be made for other portable browsers, such as Opera, Chrome, etc.,
This post has a VBScript that will register or unregister Google Chrome Portable (from PortableApps.com) with Default Apps in a single click. After registering, you can set Chrome Portable as the default browser via Default Apps.
Register Chrome Portable with Default Apps or Default Programs
PortableApps.com is a popular portable software solution allowing you to take your favorite software with you. A fully open source and free platform, it works from any synced cloud folder (DropBox, Google Drive, Box, etc), from your local PC on an internal or external drive, or on any portable storage device (USB flash drive, memory card, portable hard drive, etc) moved between PCs.
To add Google Chrome Portable web browser to Default Apps, use the VBScript below.
'Registers Google Chrome Portable with Default Programs or Default Apps in Windows 'chromeportable.vbs - created on May 20, 2019 by Ramesh Srinivasan, Winhelponline.com 'v1.1 13-June-2019 - Enclosed file name parameter in double-quotes. 'v1.2 10-Sept-2020 - Fixed ApplicationIcon path. And added other supported URL protocols. 'v1.3 23-July-2022 - Minor bug fixes. Option Explicit Dim sAction, sAppPath, sExecPath, objFile, oFSO, sbaseKey, sbaseKey2, ArrKeys, regkey Dim WshShell : Set WshShell = CreateObject("WScript.Shell") Dim oFS0 : Set oFSO = CreateObject("Scripting.FileSystemObject") Set objFile = oFSO.GetFile(WScript.ScriptFullName) sAppPath = oFSO.GetParentFolderName(objFile) sExecPath = sAppPath & "\GoogleChromePortable.exe" 'Quit if GoogleChromePortable.exe is missing in the current folder! If Not oFSO.FileExists (sExecPath) Then MsgBox "Please run this script from Chrome Portable folder. The script will now quit.", _ vbOKOnly + vbInformation, "Register Google Chrome Portable with Default Apps" WScript.Quit End If If InStr(sExecPath, " ") > 0 Then sExecPath = """" & sExecPath & """" sbaseKey = "HKCU\Software\" If WScript.Arguments.Count > 0 Then If UCase(Trim(WScript.Arguments(0))) = "-REG" Then Call RegisterChromePortable If UCase(Trim(WScript.Arguments(0))) = "-UNREG" Then Call UnregisterChromePortable Else sAction = InputBox("Type REGISTER to add Chrome Portable to Default Apps." & _ "Type UNREGISTER To remove.", "Chrome Portable Registration", "REGISTER") If UCase(Trim(sAction)) = "REGISTER" Then Call RegisterChromePortable If UCase(Trim(sAction)) = "UNREGISTER" Then Call UnregisterChromePortable End If Sub RegisterChromePortable sbaseKey2 = sbaseKey & "Clients\StartmenuInternet\Google Chrome Portable\" WshShell.RegWrite sbaseKey & "RegisteredApplications\Google Chrome Portable", _ "Software\Clients\StartMenuInternet\Google Chrome Portable\Capabilities", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\", "Chrome HTML Document", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\AppUserModelId", "Chrome Portable", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\AppUserModelId", "Chrome Portable", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationIcon", sExecPath & ",0", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationName", "Google Chrome Portable", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationDescription", "Access the internet", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\Application\ApplicationCompany", "Google Inc.", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\DefaultIcon\", sExecPath & ",0", "REG_SZ" WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\shell\open\command\", sExecPath & " -- " & """" & "%1" & """", "REG_SZ" WshShell.RegWrite sbaseKey2, "Google Chrome Portable Edition", "REG_SZ" WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationDescription", "Google Chrome Portable Edition", "REG_SZ" WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationIcon", sExecPath & ",0", "REG_SZ" WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationName", "Google Chrome Portable Edition", "REG_SZ" ArrKeys = Array ("FileAssociations\.htm", _ "FileAssociations\.html", _ "FileAssociations\.shtml", _ "FileAssociations\.xht", _ "FileAssociations\.xhtml", _ "FileAssociations\.webp", _ "URLAssociations\ftp", _ "URLAssociations\http", _ "URLAssociations\https", _ "URLAssociations\irc", _ "URLAssociations\mailto", _ "URLAssociations\mms", _ "URLAssociations\news", _ "URLAssociations\nntp", _ "URLAssociations\sms", _ "URLAssociations\smsto", _ "URLAssociations\tel", _ "URLAssociations\url", _ "URLAssociations\webcal") For Each regkey In ArrKeys WshShell.RegWrite sbaseKey2 & "Capabilities\" & regkey, "ChromeHTML2", "REG_SZ" Next WshShell.RegWrite sbaseKey2 & "DefaultIcon\", sExecPath & ",0", "REG_SZ" WshShell.RegWrite sbaseKey2 & "shell\open\command\", sExecPath, "REG_SZ" 'Launch Default Apps after registering Chrome Portable WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram" End Sub Sub UnregisterChromePortable sbaseKey2 = "HKCU\Software\Clients\StartmenuInternet\Google Chrome Portable" On Error Resume Next WshShell.RegDelete sbaseKey & "RegisteredApplications\Google Chrome Portable" On Error GoTo 0 WshShell.Run "reg.exe delete " & sbaseKey & "Classes\ChromeHTML2" & " /f", 0 WshShell.Run "reg.exe delete " & chr(34) & sbaseKey2 & chr(34) & " /f", 0 'Launch Default Apps after unregistering Chrome Portable WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram" End Sub
- Copy the above VBScript code to Notepad and save the file as
- Move the file to your removable or USB drive. The script file should be placed in the
GoogleChromePortablefolder for it to work.
chromeportable.vbsto run it.
REGISTERand click OK to add Chrome Portable to Default Apps.
- The script launches Default Apps or Default Programs automatically. Select Google Chrome Portable from the list and set it as the default.
To remove Google Chrome Portable from Default Apps, rerun the script and this time, type UNREGISTER and click OK.
RELATED: Change Default Apps, Browser or File Association via Command-line in Windows 10
Select the default browser
Note that the script registers the browser with Default Apps, but doesn’t set it as the default. This is something the user has to do manually, especially in Windows 10.
So, the script launches the Default Programs or the Default Apps (in Windows 10) window after you register or unregister the portable browser. To prevent the script from launching the Default Apps window every time, delete the following line (2 occurrences) in the script and save it:
WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"
You may also use the SetuserFTA utility to set the default browser via command-line or shortcut, if you don’t want to go through Default Apps. See Change Default Apps, Browser or File Association via Command-line.
Run the script non-interactively
To register or unregister Chrome Portable silently (non-interactively), you can use the following syntax:
wscript.exe D:\GoogleChromePortable\chromeportable.vbs -REG wscript.exe D:\GoogleChromePortable\chromeportable.vbs -UNREG
And you can even create shortcuts for the above commands:
Hope you found the script a tad useful! If you’re looking for a similar script for other portable apps, pls let’s know in the Comments section below.
One small request: If you liked this post, please share this?One "tiny" share from you would seriously help a lot with the growth of this blog. Some great suggestions:
- Pin it!
- Share it to your favorite blog + Facebook, Reddit
- Tweet it!
11 thoughts on “Register Google Chrome Portable with Default Apps or Default Programs”
Thanks Ramesh. This worked for me but after trying twice. After first run of the vbs nothing happened. I ran for again but this time from the cmd and it worked.
Useless, if the file name contains spaces it breaks the code – opens several blank pseudofiles according to number of spaces saying fle doe snot exist (of course it doe snot tfw!), repair it first OMG!
@B.O.H – I’ve fixed it now. Thanks for the feedback!
How can we do this for VLC and XNView Portable?
Yes, I was also looking for how to do this with VLC, 7z, irfanview, and others. Their in-program option for file associations doesn’t seem to work, even when I run as admin.
Get “Registry Changes View” from NirSoft on a system that does not have VLC or 7-Zip or IrfanView installed … Create an initial registry snap. Install 7-Zip, open 7-zip options and select associate with all file types, run the final snap in “Registry Changes View” snap and press ok to see the diff. Select all relevant lines in the displayed registry changes, and save that to 7zip.reg from the File menu. You can now run this on any system to automatically associate all file types to 7-Zip (you might need to change the paths in the registry script if it is installed in different locations on those other systems). This works also for VLC, IrfanView and any other app.
Thanks Ramesh for putting this together. Your 13-Jun-2019 script has a number of problems. I made an attempt at correcting the errors and to keep this comment short, saved my corrections of your amazing script at this link https://paste2.org/1cWL73B9
A huge THAN YOU!
amazing, keep up the good work!!!