Jump to content
Sign in to follow this  
robertcollier4

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

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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

 

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?

Share this post


Link to post
Share on other sites

Awesome edit OP! I will most definitely be giving this one a go. 

Any experience with this and much old/custom browsers?

Just curiosity, Thanks +1 more time

-d0x

Share this post


Link to post
Share on other sites

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 :)


Share this post


Link to post
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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
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.

Sign in to follow this  

  • 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_19.10.06.exe
      SHA-1: e9fcccdd08f85908abe1cf84290b76c98e653df5
      Taille: 47,8 Mo
    • By BYTE-ME
      2019 Windows 8 Mega Tweaks v 8.5
      I've uploaded more than 200 tweaks in HTML format to make it easier to see helper files and folder and file paths that need editing; just unzip the files and click on tweaks.html file. All the helper scripts are perfectly safe text files that you must change to a suitable file extension to work.
      File: Tweaks_85.7z CRC-32: d95f4113 MD4: d9c5dd5dc2e37ac6b29dcc3759229925 MD5: 36259453fc9bc2ea8b0536e574f4af5d SHA-1: 6c323f472be8cf0633944a90070da65c900ff0a7 DOWNLOAD:  Tweaks 8.5
      Added Windows 8.1 Readme Control Panel applet Removed temp file delete tweak Many tweaks now make backups before changing registry keys Minor spelling corrections and updated download links 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                                            
       
            
          
               

                                                                            

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