Windows – How to set default browser in Windows 7 via script

firefoxwindows 7

I'm working on a system imaging process during which both Chrome and Firefox are installed silently. I'm trying to find a way to set Firefox as the default browser for both the system default user (so any new user that logs in has FF set as default) and the current user.

The Firefox docs say that this should accomplish that, but it doesn't work:

firefox.exe -silent -setDefaultBrowser

Using process monitor I can see that the command above is doing a bunch of stuff to the registry, but after I run it my default browser hasn't been set to Firefox.

If I open Firefox and go to Tools > Options > Advanced and click the Set FF as Default Browser" button, that does work.

The problem is I don't want to have to perform manual steps every time a new laptop gets deployed so I need to find some way to accomplish the same thing from the command line.

I tried using process monitor to see what values Firefox was setting when that button is clicked so I could manually duplicate them a different way but when I click the set default button in FF procmon quite literally I see over 250 registry writes by firefox.exe and I don't really want to track them all down.

Can anyone help me figure out why firefox.exe -silent -setDefaultBrowser doesn't work or offer another way to set FF as the system/user's default browser?

Best Answer

The registration is done by the helper.exe

C:\Program Files (x86)\Mozilla Firefox\uninstall\helper.exe /SetAsDefaultAppGlobal

For the sake of completeness, if someone wants to change the default browser only for the current user

C:\Program Files (x86)\Mozilla Firefox\uninstall\helper.exe /SetAsDefaultAppUser