Register Google Chrome Portable with Default Apps or Default Programs

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.

register chrome portable with default apps

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
'Last updated on 13-Jun-2019 - Enclosed file name parameter in double-quotes.

Option Explicit
Dim sAction, sAppPath, objFile, oFSO, sbaseKey, sbaseKey2
Dim WshShell : Set WshShell = CreateObject("WScript.Shell") 
Dim oFS0 : Set oFSO = CreateObject("Scripting.FileSystemObject")

Set objFile = oFSO.GetFile(WScript.ScriptFullName)
sAppPath = oFSO.GetParentFolderName(objFile)
sAppPath = sAppPath & "\GoogleChromePortable.exe"

If Not oFSO.FileExists (sAppPath) Then WScript.Quit
If InStr(" ", sAppPath) <> 0 Then sAppPath = """" & sAppPath & """"

If WScript.Arguments.Count <> 0 Then
   If UCase(Trim(WScript.Arguments(0))) = "-REG" Then Call RegisterChromePortable(sAppPath)
   If UCase(Trim(WScript.Arguments(0))) = "-UNREG" Then Call UnregisterChromePortable(sAppPath)
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(sAppPath)
   If UCase(Trim(sAction)) = "UNREGISTER" Then Call UnregisterChromePortable(sAppPath)
End If

Sub RegisterChromePortable(sAppPath)
   sbaseKey = "HKCU\Software\"
   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\ApplicationIcon", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\ApplicationName", "Google Chrome Portable Edition", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\ApplicationDescription", "Access the internet", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\ApplicationCompany", "Google Inc.", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\DefaultIcon\", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey & "Classes\ChromeHTML2\shell\open\command\", sAppPath & " -- " & """" & "%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", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\ApplicationName", "Google Chrome Portable Edition", "REG_SZ"  
   
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.htm", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.html", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.shtml", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.xht", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.xhtml", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\FileAssociations\.webp", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\ftp", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\http", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "Capabilities\URLAssociations\https", "ChromeHTML2", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "DefaultIcon\", sAppPath & ",0", "REG_SZ"
   WshShell.RegWrite sbaseKey2 & "shell\open\command\", sAppPath, "REG_SZ"

   'Launch Default Apps after registering Chrome Portable   
   WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"  
End Sub


Sub UnregisterChromePortable(sAppPath)
   sbaseKey = "HKCU\Software\"
   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 " & sbaseKey2 & " /f", 0
   
   'Launch Default Apps after unregistering Chrome Portable   
   WshShell.Run "control /name Microsoft.DefaultPrograms /page pageDefaultProgram"   
End Sub

Usage

  1. Copy the above VBScript code to Notepad and save the file as chromeportable.vbs
  2. Move the file to your removable or USB drive. The script file should be placed in the GoogleChromePortable folder for it to work.
    register google chrome portable with default programs or default apps
  3. Double-click chromeportable.vbs to run it.
    register chrome portable with default programs or default apps
  4. Type REGISTER and click OK to add Chrome Portable to Default Apps.
  5. The script launches Default Apps or Default Programs automatically. Select Google Chrome Portable from the list and set it as the default.register chrome portable with default programs or default apps

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 use the SetuserFTA utility to set the default browser via command-line or shortcut, rather than through Default Apps. See Change Default Apps, Browser or File Association via Command-line in Windows 10.

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:

register google chrome portable with default programs or default apps

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!
So thank you so much for your support, my reader. It won't take more than 10 seconds of your time. The share buttons are right below. :)

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and he has been a Microsoft Most Valuable Professional (MVP) for 10 consecutive years from 2003 to 2012.

6 thoughts on “Register Google Chrome Portable with Default Apps or Default Programs”

  1. 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.

    Reply
  2. 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!

    Reply
  3. 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.

    Reply

Leave a Comment