Automatically setting the default browser on Windows - Use Chocolatey (choco) and Setdefaultbrowser via command line or script

Automatically setting the default browser on Windows

Automatically setting the default browser on Windows can be tricky.
Luckily, there is a special tool for exactly this task that can be installed via the Chocolatey(choco) package manager for Windows.


First, use choco to install a small tool 'setdefaultbrowser':

  choco install setdefaultbrowser


Run the tool to set the default browser to Chrome:

  SetDefaultBrowser chrome


Alternatively, in a script you can use this complete command, to avoid prompts:

  cmd /C echo y | choco install setdefaultbrowser & SetDefaultBrowser chrome


Other browsers are also supported


- Edge:
  SetDefaultBrowser Edge

-Internet Explorer = ie
  SetDefaultBrowser ie


- Firefox = (need version specific ProgId)
  SetDefaultBrowser Firefox-<ProgId>
example: SetDefaultBrowser Firefox-308046B0AF4A39CB

Firefox tip: To get the ProgId for your version of Firefox, you can use the regedit tool to search the Windows Registry. Search for Firefox or Mozilla and eventually you will find it.


More Details

For more details about the SetDefaultBrowser tool, see the documentation at https://community.chocolatey.org/packages/setdefaultbrowser


Comments