Jump to content

Set Default Portable Browser in Registry (Correctly handles .URL files)


robertcollier4
 Share

Recommended Posts

I wrote this because I was unable to find any working tools on the Internet to correctly change the default browser association in Windows (such as if you want to use a portable edition of a browser).


The problem with all of the other tools on the Internet is that they do not correctly handle .URL files. Since .URL files are text files - they have to be passed to "HKEY_CLASSES_ROOT\InternetShortcut" where the URL gets parsed by shdocvw.dll and then passed to HKEY_CLASSES_ROOT\http. With other tools - the .URL files would open as text files in the browser instead of opening the actual URL itself. This script does it correctly.

 

 

defaultbrowserinregistr.gif

 

Download here:

http://www.autohotkey.com/board/topic/89803-set-default-browser-in-registry-correctly-handles-url-files/

 

Silent mode: If no command line arguments will show GUI. Will run in silent mode if argument passed to it on command line. Silent mode if successful does not write anything to command line / stdout (Autohotkey does not natively support writing to stdio)- if you are running in silent mode and the utility runs without any popups or warning dialogs - then the change was successful.
Silent mode example: DefaultBrowserInRegistry.exe "D:\PortableApps\GoogleChromePortable\GoogleChromePortable.exe"
Edited by robertcollier4
Link to comment
Share on other sites

Can it be run in command line (silently) ?

Good idea. I have updated the script to accept a command line argument to run in silent mode. When run with an argument on the command line, the only time it will popup a dialog is to display an error message if it has received a path which it is unable to parse. (AutoHotkey does not natively support writing to stdio / stderr). If you pass it a correctly formed path - it will run completely silently and produce no dialogs.

Edited by robertcollier4
Link to comment
Share on other sites

Hi robertcollier4,

 

Tested with Firefox 18.0.2 and Win7 X64.

 

 

tested in command line and GUI

 

 

 DefaultBrowserInRegistry.exe "C:\Program Files (x86)\Mozilla Firefox\Firefox.exe" 

 

 

Doesn't work.

 

How do you know it didn't work? What is the problem you are having? When running in silent mode - if it worked - there is no output / nothing written to command line.

 

What is the content of the following key in regedit.exe? - HKEY_CLASSES_ROOT\MyHTMLFile\Shell\Open\Command

Link to comment
Share on other sites

How do you know it didn't work? What is the problem you are having?

 

 

because IE was still the default program (you can check that easily in control panel) and besides Firefox still asking to be the default browser when launched.

Link to comment
Share on other sites

because IE was still the default program (you can check that easily in control panel) and besides Firefox still asking to be the default browser when launched.

Firefox asking to be the default browser when launched will still happen when using this tool - because Firefox writes its own custom Handler type for example class "FirefoxHTML" whereas I use a generic class "MyHTMLFile" in this script. Regardless, it says nothing as per the functionality of whether this works. This tool was designed mainly for Portable versions of browsers in which checking for default browser should be disabled anyways - and this tool does not guarantee to mimic exactly the classes used by all the different browsers - but its goal is just to write all the keys so that they are correctly functional.

 

The most important thing to see is if direct launching http links, launching htm/html/mht files, and launching url files is working or not. When you click on a htm file from the explorer - is it opening with the browser you specified? All of the other things are cosmetic only.

 

Regarding the browser displayed in Control Panel for Windows 7, is this the screen you are looking at, and would you mind doing a check for me since I do not use Windows 7? Could you open up regedit and make the following change?

HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice

"ProgId"="MyHTMLFile"

 

Try redownloading the file - I have added UserChoice reg entries to the tool and tell me if this changes what Windows 7 shows in Control Panel.

Edited by robertcollier4
Link to comment
Share on other sites

  • 8 months later...

 

I wrote this because I was unable to find any working tools on the Internet to correctly change the default browser association in Windows (such as if you want to use a portable edition of a browser).

The problem with all of the other tools on the Internet is that they do not correctly handle .URL files. Since .URL files are text files - they have to be passed to "HKEY_CLASSES_ROOT\InternetShortcut" where the URL gets parsed by shdocvw.dll and then passed to HKEY_CLASSES_ROOT\http. With other tools - the .URL files would open as text files in the browser instead of opening the actual URL itself. This script does it correctly.

 

 

defaultbrowserinregistr.gif

 

Download here:

http://www.autohotkey.com/board/topic/89803-set-default-browser-in-registry-correctly-handles-url-files/

 

Silent mode: If no command line arguments will show GUI. Will run in silent mode if argument passed to it on command line. Silent mode if successful does not write anything to command line / stdout (Autohotkey does not natively support writing to stdio)- if you are running in silent mode and the utility runs without any popups or warning dialogs - then the change was successful.
Silent mode example: DefaultBrowserInRegistry.exe "D:\PortableApps\GoogleChromePortable\GoogleChromePortable.exe"

 

This Great!!

 

 

but a small question:
when I open a .chm file is not displayed correctly.
Their submenus are opened in the default browser before established not in the main window.
You observed this strange behavior as due to the script?
Link to comment
Share on other sites

  • 3 months later...
  • 9 months later...

Hi,


 


Thanks for that, It is working just fine for all browsers. 


I have no experience in scripts but I wanted to know if it was possible to edit the script to make chrome (for example) the default browser in one click only without the need to enter the path manually in the GUI


 


Thanks :)


Link to comment
Share on other sites

I don't think that request makes sense because the script is meant for portable browsers which do not have a defined location where they are located.  You have to tell the script somehow specifically where the browser is located.

 

Cheers and Regards

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 years later...

For those that have found this thread from search and are having problems in Win7 and above, I made a new less invasive reg script for this for Win7 attached. This is as a reg file instead since its easier to read. Youll need to do a find-replace as instructed in the file on your Browser path.

Changes:
This one is less invasive and doesnt replace the HKEY_CLASSES_ROOT keys, but rather uses the new Win7 UserChoice entry method so that you can use Control Panel > Default Programs > Set your default programs > Choose defaults for this program to make them active at:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.xxx\UserChoice

StartMenuInternet FileAssociations Win7.reg

Edited by robertcollier4
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Similar Content

    • By mooms
      Je vous propose ici une archive SFX qui regroupe plus d'une quarantaine utilitaires, tous gratuits et portables.
      Ils sont copiés dans %HOMEDRIVE%\Utilitaires\ (soit C:\Utilitaires dans la majorité des cas) et des raccourcis dans le Menu Démarrer sont créés.
       
       
      Pour l'installer silencieusement, utilisez le commutateur -ai . Les versions x86 et/ou x64 sont automatiquement installées suivant l'architecture (pour le 64 bits certains ont aussi leur version 32 bits). Compatible Windows 7-10. La désinstallation supprime le dossier %HOMEDRIVE%\Utilitaires\  ainsi que les raccourcis du menu Démarrer. A l'installation d'une nouvelle version , la précédente est automatiquement désinstallée , et les éventuels programmes en cours d'exécution et faisant partie de la suite sont fermés. Note: Quelques programmes inclus sont détéctés par certains antivirus, ce sont des faux-positifs.

      Liste des programmes inclus:
       
      SFX_Utilitaires_21.11.25.7z
      SHA-1: ad7b6ea1d98eee70cc94f04dda0f34a293c33a06
      Taille: 43,6 Mo
      mot de passe: mon pseudo.
       
      FFMpeg pour Screentogif (facultatif):
      SFX_FFMpeg.exe
      SHA-1: ca9a6e2e5a97affb41465157184896be6b94f935
      Taille: 17,1 Mo
      FFMpeg pour ScreenTogif est relativement gros et peu souvent mis à jour, je le propose donc dans un téléchargement facultatif.
      Le SFX est à exécuter après l’installation du pack d’utilitaires, et à chaque fois que ce dernier est réinstallé.
       
       
    • By BYTE-ME
      2021 Windows Mega Tweaks v 10.0
      All new, installable setup file that gives access to more than 100 Windows tweaks.
      File: BMTweaks10.1.7z CRC-32: 213e6985 MD4: 596f348005c26af05c967a4930bba0f1 MD5: b1d15639bb8977b20f18837fa0846a42 SHA-1: 81d1f8eee581cddf778cd03db60dffd64525a7f7 DOWNLOAD:  Tweaks 10.0
      Created an installer for the Tweaks and made them uninstallable Added a Readme.pdf file in the download archive to explain installation options Pruned the number of example Control Panel applets to five Many tweaks now make backups before changing registry keys Updated tame your control panel tweak Improved scripts to selectively remove buggy Windows updates and  telemetry features Added more than a half-dozen new tweaks Improved and annotated Windows Scheduled Tasks tweak and made disabling of Windows Defender and defrag, drives, optional                                            
          
      --------------------------------------------Tweak Guide Examples------------------------------------------------------
                   
       
             
    • By BYTE-ME
      Post deleted and moved
    • By BusyElf
      I've researched the subject and have found almost all info needed to construct a batch command pipeline except how to get all keys from .reg file (or from command line) to get properly inserted into mounted subkey.
      I did found info about method involving running reg/regedit under desired user account, but i doubt it would work for user accounts inside wim and i also need to target key "HKU/.DEFAULT". I didn't test this.
      I have succeeded importing a hand-crafted .reg file into mounted subkey, but this would require me to manually alter all keys in .reg file so they get under required locations.
      If there is no other solution, i will try to put something together to partially automate this task.
    • By Kormann
      Hello guys,
       
      Do you know if I import a registry file through Tweaks if this is going to be added to all users?
       
      I'm building a Windows 7 SP1 Customized Image.
       
      I know for sure if I do it manually through the WIM Reg editor that its possible.
      If this was possible through the Tweaks section at AIO Integrator, instead of doing my tweaks everytime through the WIM Reg Editor I would just need load my tweaks preset.
       
      The code that I want to add:

       
      Windows Registry Editor Version 5.00; Add Network Connections to Network context menu[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\shell][HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\shell\Network Connections]@="@%SystemRoot%\\system32\\netshell.dll,-1200"[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\CLSID\{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}\shell\Network Connections\command]@="rundll32.exe shell32.dll,Control_RunDLL ncpa.cpl,,0"Thanks in advance.
×
×
  • Create New...