Posted February 1, 201312 yr 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. 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 February 7, 201312 yr by robertcollier4
February 1, 201312 yr Author 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 February 1, 201312 yr by robertcollier4
February 6, 201312 yr 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.
February 7, 201312 yr Author 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
February 8, 201312 yr 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.
February 8, 201312 yr Author 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 February 8, 201312 yr by robertcollier4
October 13, 201311 yr 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. 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?
October 13, 201311 yr Hiforgot my previous comment,all works fine.Is only a problem of te uTorrent help file.thx.
February 1, 201411 yr 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
November 29, 201410 yr 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
November 29, 201410 yr 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
December 27, 201410 yr The original script doesn't work, or your attempted modification didn't work? Cheers and Regards
September 17, 20195 yr Author 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 September 17, 20195 yr by robertcollier4
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.