How To Change Default Browser From Command Line on Windows 10

The Short Answer: Use the SetDefaultBrowser tool made by Christoph Kolbicz. Run it once with no command-line options to see your browsers. Then run something like SetDefaultBrowser.exe HKLM FIREFOX.EXE to switch to Firefox, or SetDefaultBrowser.exe HKLM "Google Chrome" to switch to Chrome. The output of the first call, with no parameters, will tell you exactly what parameters you'll need to pass in for each of your browsers. It's fast and reliable, and appears to support a broad array of browsers.

The Longer Version

When I'm working, I use Chrome as my default browser. For personal stuff, I prefer Firefox. As a result, I like to be able to quickly change my default browser depending on whether I'm in working. I sometimes end up switching multiple times per day. I used to just set Chrome as my default, and then copy-and-paste personal URLs into Firefox -- an annoyance and a time-suck.

Now I use SetDefaultBrowser, and I tied this in with the SlickRun launcher to make switching as quick and pleasant as possible. I've been using SlickRun as the launcher for all my scripts and shortcuts for many years, I love it, and I recommend chipping in a few bucks to the developer to keep it going if you love it, too.

While you're at it, if you find that SetDefaultBrowser saves you time and makes your life a little more pleasant, consider putting a little something in Christoph's tip jar.

To find out what browsers are available on your computer, run SetDefaultBrowser.exe on its own, with no command-line parameters. The first line of each entry tells you what parameter to pass into SetDefaultBrowser.exe to make that browser your default.

Now, from anywhere in Windows, I can do the following to switch to Firefox:
  • Type Alt+Q to bring up the SlickRun launcher
  • Type my custom "usefirefox" shortcut in the SlickRun launcher window, which runs the following command:
    • SetDefaultBrowser.exe HKLM FIREFOX.EXE

... and Boom! Firefox is now my default browser. To switch back to Chrome, I type Alt+Q and "usechrome" and I'm back to Chrome as my default. Behind the scenes, this runs SetDefaultBrowser.exe HKLM "Google Chrome". So far, it's fast and reliable. It's also something that can be easily integrated into a larger "start my workday" script.

If you found this helpful, you'd like to thank me, and you enjoy reading -- or know someone who does -- buy one of my books!


comments powered by Disqus