Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

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


  • Please log in to reply
4 replies to this topic
robertcollier4
  • Members
  • 141 posts
  • Last active: Jun 28 2019 01:05 AM
  • Joined: 11 Nov 2012

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.
 
Tested on WinXP SP3 x86 but should work on Vista and Win7 since the keys are documented as being the same. For documentation about the registry keys see here and see here2 and see here3.


 defaultbrowserinregistr.gif

 

Download: DefaultBrowserInRegistry.ahk (7KB) - requires AutoHotKey to run
Download: DefaultBrowserInRegistry.exe (200KB) - compiled EXE, use this if you do not have AutoHotkey

 

If no command line arguments will show GUI. Will run in silent mode if argument passed to it on command line. 
Silent mode example: DefaultBrowserInRegistry.exe "D:\PortableApps\GoogleChromePortable\GoogleChromePortable.exe"

 
Code:

Spoiler

Edited by robertcollier4, 01 February 2013 - 02:25 PM.


samoguz
  • Members
  • 1 posts
  • Last active: Mar 06 2013 02:32 PM
  • Joined: 06 Mar 2013

Thank you, I'll give a try and post an update.



Cragaha
  • Members
  • 265 posts
  • Last active: Jan 04 2016 02:24 AM
  • Joined: 19 Nov 2010

Thanks for sharing robertcollier4,

 

Just tried it on windows 7, it's the same problem as with all other similar tools like RegisterFirefoxPortable.

You still need to go to Start-Default Programs-Set your default programs and do some more clicking to get it to work.

So all these tools do is get the portable browser to be listed there, but that's all.

A while ago I tried to write a script to do it automatically but gave up.



aloisb
  • Members
  • 1 posts
  • Last active: Jul 19 2013 08:08 PM
  • Joined: 19 Jul 2013

DefaultBrowserInRegistry.ahk has (at least) one bug in line 44:

 

Regwrite, REG_SZ, HKEY_CLASSES_ROOT, .html,Content Type,text/mhtml

 

correct code is:

 

Regwrite, REG_SZ, HKEY_CLASSES_ROOT, .mht,Content Type,text/mhtml



flam
  • Members
  • 1 posts
  • Last active: Aug 31 2013 08:17 AM
  • Joined: 30 Aug 2013

Hi robertcollier4,

 

Your script was working fine until I tried to run Skype. When starting the app, I’ve got a blank window and .html file opening in browser which looked like a main skype login screen (it was not possible to log in thru it though). Now I’m just getting blank skype window every time, looks like this:

 

Vm2Y6Wq.jpg

 

Any tips how to resolve the issue? Reinstalling skype didn’t help so I suppose there need to be something changed in the registry but I’m a noob and have no idea where and which values. Any tips highly appreciated.

 

And of course I didn’t made registry backup before using this script...