# Solved: Quick-change default browser?



## Soundy (Feb 17, 2006)

This is probably more of a general Windows thing, but I at least need to do it on Win7: I'd like to be able to quickly change the default browser, either via script, command line, or shortcut. 

Specifically: I normally use Chrome as my browser, but sometimes in my work, I need to have IE load by default (called from an IP camera setup utility). I'd like to be able to just click a shortcut/link that will make IE the default, then click another to set it back to Chrome when I'm done. Or, if I can script it, run a script that will change to IE, pause until I'm done (with a "Press ENTER" prompt or similar), then set it back to Chrome and exit.


----------



## Ent (Apr 11, 2009)

One option would be to manipulate the registry keys directly. An alternative might be a script calling the following.

To Set IE
shmgrate.exe OCInstallReinstallIE
http://arstechnica.com/civis/viewtopic.php?f=15&t=268555

And to set Chrome
http://www.waltercedric.com/compone...-chrome-exhaustive-command-line-switches.html
Especially the line "--make-default-browser | Make Chrome default browser"

And just for completeness to set FF as default
http://kb.mozillazine.org/Setting_Your_Default_Browser#Force_Firefox_to_make_itself_the_default
firefox.exe -silent -setDefaultBrowser


----------



## Soundy (Feb 17, 2006)

Thanks Ent... do you know what the specific registry keys are? That might be the easiest way - I found that ARS Technica bit... unfortunately Win7 doesn't include the "shmgrate.exe" utility (I did a full search), and that post is from 2006. Knowing Microsoft, I won't be surprised if it doesn't work with IE8.

I did find the Chrome bit after I posted this... just need to source "shmgrate.exe" now.


----------



## Ent (Apr 11, 2009)

As I understand it the default browser is defined simply as what browser is set to open http, https and so on. If that is correct you'd need to change the values in HKCU/Software/Classes/HTTP (replacing http with the other protocols as appropriate) to make a change for a single user account (and avoid needing to give UAC permission) or HKLM/Software/Classes/HTTP to make the change system wide. These are collated together by Windows to give HKCR. I'm not certain in this though, and don't know what changes would be made to specify the browser.


----------



## Soundy (Feb 17, 2006)

Played with this a bit, doesn't seem to make a difference... in HKCU it's Chrome, in HKLM it's IE, and nothing seems to actually change it.

I need something that can scan the registry before and after a change and export/display what's actually changed, hmmm....


----------



## Ent (Apr 11, 2009)

HKLM stands for Hkey Local Machine, and affects the whole computer unless overridden by something else. KHCU stands for HKey Current User, is limited to one user account, but overrides HKLM. Hence chrome is default even though HKLM says IE.


----------



## Soundy (Feb 17, 2006)

I know what they stand for... turns out neither is actually aren't related to this.

Found an app called "regsnap" - take a current snapshot of the registry, make manual changes, take another snapshot, then produce a text file showing what's changed. As it happens, everything that changes is in HKey_Users.

For IE:

```
Windows Registry Editor Version 5.00

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Clients\StartMenuInternet]
@="IEXPLORE.EXE"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice]
"Progid"="IE.AssocFile.HTM"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice]
"Progid"="IE.AssocFile.HTM"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice]
"Progid"="IE.FTP"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice]
"Progid"="IE.HTTP"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice]
"Progid"="IE.HTTPS"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Google\GoogleToolbarNotifier]
"AC"=hex(b):13,53,61,4d,00,00,00

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Internet Explorer\Main]
"FullScreen"="yes"
```
For Chrome:

```
Windows Registry Editor Version 5.00

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Clients\StartMenuInternet]
@="Google Chrome"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.htm\UserChoice]
"Progid"="ChromeHTML"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.html\UserChoice]
"Progid"="ChromeHTML"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\ftp\UserChoice]
"Progid"="ChromeHTML"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice]
"Progid"="ChromeHTML"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice]
"Progid"="ChromeHTML"

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Google\GoogleToolbarNotifier]
"AC"=hex(b):03,45,61,4D,00,00,00,00

[HKEY_USERS\S-1-5-21-3344783791-1742396771-406126749-1000\Software\Microsoft\Internet Explorer\Main]
"FullScreen"="no"
```
There's probably some stuff in there that's not necessary, and I do get an error that some keys couldn't be imported because they're in use... but this does what I need it to do 

Not the most elegant solution, as it still takes three extra clicks (Yes, I want to run regedit; yes I wand to merge; okay, something was still in use), but for as often as I need to use it, it'll do.


----------



## Ent (Apr 11, 2009)

I know that the basic double click .reg file is easier to make, but have you considered creating a batch script or similar solution? For example using the command line _reg_ command you can import a reg script from the command prompt (and therefore from a batch file) which doesn't have the prompts you mentioned. You could also insert the Pause command you mentioned earlier between launching the first and second reg scripts.


----------



## Soundy (Feb 17, 2006)

Script will be the next step, although I suspect I'll still have to force it to run as Administrator, and it will probably still throw me a "keys in use" popup. I can just use "regedit /s filename.reg". My original idea was the script it anyway... throw a PAUSE command in and just leave it in the background until I'm done with IE.


----------

