Setting Default Browser From The Command-Line

I use Firefox as my primary web browser. I really like tab browsing and usually have 20+ tabs open at any one time. Thanks to the Session Saver extension (or, nowadays, Firefox’s built-in session manager), I usually just close Firefox when I’m done for the day and resume surfing those 20+ pages at a later time.

However, this can be a big pain for the occasional “I just need to check one thing” moments. With 20+ tabs open, it can take Firefox thirty seconds to a minute to open all those web pages and become responsive on my system. Many times I’ve clicked on a link in an email or IM conversation, only to forget that Firefox was closed. Firefox will then open and my system will grind to a halt whilst the browser tries to open 27 different web pages at once. I’m not opposed to using Internet Explorer in such moments, but you’d need to either a) cut and paste the link (not easily done in most versions of Outlook if it’s an embedded link), or b) open IE and drill through the options menu to set IE as default, then go back to Outlook\IM app and click on the link.

So yesterday I had one of those “Hmmmm… I wonder if…” moments, and I searched for a way to change the default browser via command-line. And yes, there is a way; just paste the following commands into individual Notepad windows:

shmgrate.exe OCInstallReinstallIE

“c:\program files\Mozilla Firefox\firefox.exe” -silent -nosplash -setDefaultBrowser

As you can probably guess, the top command makes IE the default browser, whilst the second makes Firefox the default browser. Just save the Notepad windows as BAT or CMD files and put them in a PATH folder (for the keyboard lovers) and\or make shortcuts to them in the Quick Launch folder. If you use this on a regular basis, you might want to clear the “Always check to see if XXX is the default browser” boxes that appear at startup.

This trick works with Firefox 1.5.0.7 and the latest version of Session Saver. Although the documentation I found about the IE command was for IE 6, it works on my system (which is running IE 7 RC2).

I don’t know if anyone wants or needs this, but I thought it might come in handy for people like me, or web developers, or when several people use one computer (“Mom likes Firefox, Dad still likes IE” situations).

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.