Temporarily change default browser

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Temporarily change default browser

#1 Post by drgt » 27 Oct 2017 23:43

Hi
On my stick I have a portable program and a portable browser.

Is there a way to write a batch file which will change the default browser to the one on my stick, call the portable program, and upon exit of the portable program, change the default browser to what it was before the change?

Thanks
Windows XP SP2

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Temporarily change default browser

#2 Post by aGerman » 28 Oct 2017 05:10

I can't help you much here because programmatically changing the default browser isn't possible on Win 10 anymore.
I remember that it was possible on XP by changing and creating registry values. I also remember that different browsers created different registry keys and values. So I'm afraid if you don't find all of those registry settings for your certain browser in the internet you have to compare the registry before and after setting the browser as default by hand.

Steffen

drgt
Posts: 160
Joined: 21 Sep 2010 02:22
Location: Greece

Temporarily change default browser

#3 Post by drgt » 29 Oct 2017 01:22

Suppose there is a way to do it in registry.

Don' I have to reboot in order for the change to take effect?

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Temporarily change default browser

#4 Post by aGerman » 29 Oct 2017 04:36

It depends on where you have to do the registry updates. Changes in HKLM may require a reboot.

Steffen

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Temporarily change default browser

#5 Post by Ed Dyreen » 11 Nov 2017 23:00

The keys you are looking for are;

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\HTTP\shell\open\command]
[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command]
[HKEY_CURRENT_USER\Software\Classes\http\shell\open\command]
[HKEY_CURRENT_USER\Software\Classes\https\shell\open\command]

Any browser that wants to set itself as the default program for opening http or https connections needs to register itself here.

File associations are not affected.

restoreDefaultBrowser.reg

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\HTTP\shell\open\command]
@="\"D:\\IE\\browser\\Firefox v3.6.12-en-US\\firefox.exe\" -osint -url \"%1\""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command]
@="\"D:\\IE\\browser\\Firefox v3.6.12-en-US\\firefox.exe\" -osint -url \"%1\""

[HKEY_CURRENT_USER\Software\Classes\http\shell\open\command]
@="\"D:\\IE\\browser\\Firefox v3.6.12-en-US\\firefox.exe\" -osint -url \"%1\""

[HKEY_CURRENT_USER\Software\Classes\https\shell\open\command]
@="\"D:\\IE\\browser\\Firefox v3.6.12-en-US\\firefox.exe\" -osint -url \"%1\""
removeDefaultBrowser.reg

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\HTTP\shell\open\command]
@=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\https\shell\open\command]
@=""

[HKEY_CURRENT_USER\Software\Classes\http\shell\open\command]
@=""

[HKEY_CURRENT_USER\Software\Classes\https\shell\open\command]
@=""
Changes take effect immediately, no reboot is required.

Post Reply