How to automate setting Chrome as default browser in Windows 10

96,590

Solution 1

Have you tried making a .vbs file to set Chrome as the default browser automatically?

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=google%20chrome"
WScript.Sleep 1200
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WScript.Quit

Reference: comment by user "Raz" in Making IE the default browser in Windows 10 during OSD

Solution 2

To change default browser in Windows 10 try the tool SetDefaultBrowser – Set the Default Browser per command line or script by Christoph Kolbicz.

The following worked fine for me:

SetDefaultBrowser.exe HKLM "Google Chrome"

Solution 3

Here is the PowerShell version of the Judy Li / Raz solution:

function Set-ChromeAsDefaultBrowser {
    Add-Type -AssemblyName 'System.Windows.Forms'
    Start-Process $env:windir\system32\control.exe -ArgumentList '/name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=google%20chrome'
    Sleep 2
    [System.Windows.Forms.SendKeys]::SendWait("{TAB} {TAB}{TAB} ")
}

Solution 4

The answer from Judy Li still worked for me on 2021-01-04 with the latest windows 10 built. However, I had to update the the number of tab's and sleep commands.

The updated steps are:

  1. Create a VBS files with the code below
  2. Open folder shell:startup with [win]+[r] or file explorer
  3. Store the file in the startup folder to execute the script with each restart

VBS Code

Set WshShell = WScript.CreateObject("WScript.Shell")

' Open the default settings window
WshShell.Run "%windir%\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram\pageAdvancedSettings?pszAppName=google%20chrome"
WScript.Sleep 5000 ' Wait until open (adjust if necessary)

' Adjust number of tabs until you reach the browser choice setting
WshShell.SendKeys "{TAB}" 
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"
WshShell.SendKeys "{TAB}"

' Open the browser choice menu
WshShell.SendKeys " " 
WScript.Sleep 500 ' Wait until open

WshShell.SendKeys "{TAB}" ' Move down one selection
WshShell.SendKeys " " ' Set current selection as default browser

WScript.Sleep 500 ' Wait until open
' Uncomment the line below to outomatically close the settings window
' WshShell.SendKeys "%{F4}" 
WScript.Quit

Solution 5

The Default Application Associations for all users are stored in the following file:

C:\Windows\System32\OEMDefaultAssociations.xml

Find extensions or protocols that use edge and change them to chrome, for example, you can replace the following associations:

<Association Identifier=".htm" ProgId="MSEdgeHTM" ApplicationName="Microsoft Edge" />
<Association Identifier=".html" ProgId="MSEdgeHTM" ApplicationName="Microsoft Edge" />
<Association Identifier="http" ProgId="MSEdgeHTM" ApplicationName="Microsoft Edge" />
<Association Identifier="https" ProgId="MSEdgeHTM" ApplicationName="Microsoft Edge" />

To open in chrome instead:

<Association Identifier=".htm" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
<Association Identifier=".html" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
<Association Identifier="http" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
<Association Identifier="https" ProgId="ChromeHTML" ApplicationName="Google Chrome" />

You can change whatever associations you'd like, but should leave the rest in place. I have a script that pulls this file down from an S3 bucket and applies it as part of the machine provisioning process.

For example, here's my entire OEMDefaultAssociations.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<DefaultAssociations>
  <Association Identifier=".3g2" ProgId="WMP11.AssocFile.3G2" ApplicationName="Windows Media Player" />
  <Association Identifier=".3gp" ProgId="WMP11.AssocFile.3GP" ApplicationName="Windows Media Player" />
  <Association Identifier=".3gp2" ProgId="WMP11.AssocFile.3G2" ApplicationName="Windows Media Player" />
  <Association Identifier=".3gpp" ProgId="WMP11.AssocFile.3GP" ApplicationName="Windows Media Player" />
  <Association Identifier=".aac" ProgId="WMP11.AssocFile.ADTS" ApplicationName="Windows Media Player" />
  <Association Identifier=".adt" ProgId="WMP11.AssocFile.ADTS" ApplicationName="Windows Media Player" />
  <Association Identifier=".adts" ProgId="WMP11.AssocFile.ADTS" ApplicationName="Windows Media Player" />
  <Association Identifier=".avi" ProgId="WMP11.AssocFile.AVI" ApplicationName="Windows Media Player" />
  <Association Identifier=".bmp" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".dib" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".flac" ProgId="WMP11.AssocFile.FLAC" ApplicationName="Windows Media Player" />
  <Association Identifier=".gif" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".jfif" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".jpe" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".jpeg" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".jpg" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".m2t" ProgId="WMP11.AssocFile.M2TS" ApplicationName="Windows Media Player" />
  <Association Identifier=".m2ts" ProgId="WMP11.AssocFile.M2TS" ApplicationName="Windows Media Player" />
  <Association Identifier=".m3u" ProgId="WMP11.AssocFile.m3u" ApplicationName="Windows Media Player" />
  <Association Identifier=".m4a" ProgId="WMP11.AssocFile.M4A" ApplicationName="Windows Media Player" />
  <Association Identifier=".m4v" ProgId="WMP11.AssocFile.MP4" ApplicationName="Windows Media Player" />
  <Association Identifier=".mkv" ProgId="WMP11.AssocFile.MKV" ApplicationName="Windows Media Player" />
  <Association Identifier=".mod" ProgId="WMP11.AssocFile.MPEG" ApplicationName="Windows Media Player" />
  <Association Identifier=".mov" ProgId="WMP11.AssocFile.MOV" ApplicationName="Windows Media Player" />
  <Association Identifier=".MP2" ProgId="WMP11.AssocFile.MP3" ApplicationName="Windows Media Player" />
  <Association Identifier=".mp3" ProgId="WMP11.AssocFile.MP3" ApplicationName="Windows Media Player" />
  <Association Identifier=".mp4" ProgId="WMP11.AssocFile.MP4" ApplicationName="Windows Media Player" />
  <Association Identifier=".mp4v" ProgId="WMP11.AssocFile.MP4" ApplicationName="Windows Media Player" />
  <Association Identifier=".mpa" ProgId="WMP11.AssocFile.MPEG" ApplicationName="Windows Media Player" />
  <Association Identifier=".MPE" ProgId="WMP11.AssocFile.MPEG" ApplicationName="Windows Media Player" />
  <Association Identifier=".mpeg" ProgId="WMP11.AssocFile.MPEG" ApplicationName="Windows Media Player" />
  <Association Identifier=".mpg" ProgId="WMP11.AssocFile.MPEG" ApplicationName="Windows Media Player" />
  <Association Identifier=".mpv2" ProgId="WMP11.AssocFile.MPEG" ApplicationName="Windows Media Player" />
  <Association Identifier=".mts" ProgId="WMP11.AssocFile.M2TS" ApplicationName="Windows Media Player" />
  <Association Identifier=".png" ProgId="PBrush" ApplicationName="Paint" />
  <Association Identifier=".tif" ProgId="PhotoViewer.FileAssoc.Tiff" ApplicationName="Windows Photo Viewer" />
  <Association Identifier=".tiff" ProgId="PhotoViewer.FileAssoc.Tiff" ApplicationName="Windows Photo Viewer" />
  <Association Identifier=".TS" ProgId="WMP11.AssocFile.TTS" ApplicationName="Windows Media Player" />
  <Association Identifier=".TTS" ProgId="WMP11.AssocFile.TTS" ApplicationName="Windows Media Player" />
  <Association Identifier=".txt" ProgId="txtfile" ApplicationName="Notepad" />
  <Association Identifier=".url" ProgId="IE.AssocFile.URL" ApplicationName="Internet Browser" />
  <Association Identifier=".wav" ProgId="WMP11.AssocFile.WAV" ApplicationName="Windows Media Player" />
  <Association Identifier=".website" ProgId="IE.AssocFile.WEBSITE" ApplicationName="Internet Explorer" />
  <Association Identifier=".wm" ProgId="WMP11.AssocFile.ASF" ApplicationName="Windows Media Player" />
  <Association Identifier=".wma" ProgId="WMP11.AssocFile.WMA" ApplicationName="Windows Media Player" />
  <Association Identifier=".wmv" ProgId="WMP11.AssocFile.WMV" ApplicationName="Windows Media Player" />
  <Association Identifier=".WPL" ProgId="WMP11.AssocFile.WPL" ApplicationName="Windows Media Player" />
  <Association Identifier=".htm" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
  <Association Identifier=".html" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
  <Association Identifier=".url" ProgId="IE.AssocFile.URL" ApplicationName="Google Chrome" />
  <Association Identifier=".webp" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
  <Association Identifier="ftp" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
  <Association Identifier="http" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
  <Association Identifier="https" ProgId="ChromeHTML" ApplicationName="Google Chrome" />
</DefaultAssociations>
Share:
96,590

Related videos on Youtube

Josh
Author by

Josh

Updated on September 18, 2022

Comments

  • Josh
    Josh over 1 year

    I've tried setting default in the reg keys:

    hkeycu>software>microsoft>windows>shell>associations>urlassociations>http and https.

    Tried using master_preference file.

    Tried using command switch --make-default-browser.

    So far these aren't working.

    Any help would be appreciated. Open to any to batch files, registry keys, file replacements/edits... basically anything I can automate.

  • Merger
    Merger about 7 years
    Wow, that actually worked! Thanks a lot for this; I've been wanting a way to do this for ages!
  • Merger
    Merger about 7 years
    Also, if you want to run this on startup, just put the .vbs file in %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup
  • Merger
    Merger about 7 years
    Also, you can simplify the SendKeys bits into just WshShell.SendKeys "{TAB} {TAB}{TAB} ".
  • Ellipsis
    Ellipsis over 6 years
    I've noticed that this makes Chrome the default for all file types it can open. This overrides the default for opening PDFs to Chrome which isn't preferred in my particular situation. Would it be possible to avoid the PDF filetype being modified? (.html, .shtml, .htm, etc - pretty much everything except PDF). I suppose I'm looking to replicate the behaviour of changing 'Web Browser' in "Default Apps" (automatically, and ideally silently).
  • MickyD
    MickyD almost 5 years
    Doesn't work in Windows 10 1809
  • Máté Juhász
    Máté Juhász about 4 years
    Question is about making chrome default browser, not making it default program for some file types.
  • Merger
    Merger about 4 years
    This should be the accepted answer
  • Merger
    Merger about 4 years
    This answer stopped working in Windows 10 1803. Instead, use this answer.
  • NitrusCS
    NitrusCS about 4 years
    well...what is a "default browser" except the program that gets launched when the user clicks a link to visit a web page?
  • Mark McClelland
    Mark McClelland almost 4 years
    I'm happy to report that this does not affect which app opens PDFs by default. So far, this works great for me. Fast and reliable.
  • holzkohlengrill
    holzkohlengrill over 2 years
    What does the part \pageAdvancedSettings?pszAppName=google%20chrome do? I don't see any difference when omitting this part.
  • Community
    Community about 2 years
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.