How to automate setting Chrome as default browser in Windows 10

19

6

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.

Josh

Posted 2016-04-25T01:17:31.617

Reputation: 211

1

This should work for any program you need to set, just change the file path....http://nuance.custhelp.com/app/answers/detail/a_id/15717/~/how-to-set-the-default-pdf-application-from-the-command-line

– Moab – 2016-04-25T02:46:07.787

Check out Judy Li's answer below; it worked for me!

– Sam – 2017-04-05T23:48:28.640

Answers

9

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

Judy Li

Posted 2016-04-25T01:17:31.617

Reputation: 109

Wow, that actually worked! Thanks a lot for this; I've been wanting a way to do this for ages! – Sam – 2017-04-05T23:47:57.350

Also, if you want to run this on startup, just put the .vbs file in %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup – Sam – 2017-04-06T00:35:07.030

1Also, you can simplify the SendKeys bits into just WshShell.SendKeys "{TAB} {TAB}{TAB} ". – Sam – 2017-04-14T03:29:17.503

2I'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). – Ellipsis – 2018-01-26T08:52:44.697

Doesn't work in Windows 10 1809 – MickyD – 2019-06-11T04:54:20.300

4

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} ")
}

BenH

Posted 2016-04-25T01:17:31.617

Reputation: 135

2

To change default browser in Windows 10 try the tool from Christoph Kolbicz - https://kolbi.cz/blog/2017/11/10/setdefaultbrowser-set-the-default-browser-per-user-on-windows-10-and-server-2016-build-1607/.

Launched SetDefaultBrowser.exe HKLM "Google Chrome" and it worked fine for me.

Aldis

Posted 2016-04-25T01:17:31.617

Reputation: 121

1

I modified the script above so that it will only change the default browser and not any of the other settings (mail, pdf, etc.) So this mimics changing the default browser usuing the Default Apps in Windows 10.

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 "{TAB}"   
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys " "
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys " "
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys " "
WshShell.SendKeys "{DOWN}"
WshShell.SendKeys " "
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WScript.Quit

Brendan Murphy

Posted 2016-04-25T01:17:31.617

Reputation: 11

1

This is not fully automated but reduces the steps required. Go to Settings, find "Default Apps" and right click on it and choose "Pin to Start". You can then get back to the selection screen in 2 clicks.

DANIEL T TEHAN

Posted 2016-04-25T01:17:31.617

Reputation: 11

0

Take the script from Judy Li’s answer and tweak it.

Option Explicit
Dim oShell, sWinDir
Set oShell = WScript.CreateObject("WScript.Shell")
sWinDir = oShell.ExpandEnvironmentStrings("%WINDIR%")
oShell.Run sWinDir & "\system32\control.exe /name Microsoft.DefaultPrograms /page pageDefaultProgram"
Set oShell = Nothing
WScript.Quit

Save it on your desktop as a .vbs file (e.g., SetDefaultProgams.vbs).  Double clicking it will bring up the more familiar Set Default Programs with the list on the left, like previous versions of Windows 10.

(Of course there are other ways to invoke a program / script.  You could put it on your Start Menu, or run it through CMD or PowerShell.)

This script was tested by me on Windows version 10.0.16299.192.

user862314

Posted 2016-04-25T01:17:31.617

Reputation: 1

-1

Update

This technique no longer works in Windows 10 1803. See this answer instead.


I wrote a little program that does this silently based on Judy Li's technique: Set Default Browser. See the page for more info.

Sam

Posted 2016-04-25T01:17:31.617

Reputation: 1 171

-5

On Windows 10, open Settings -> System -> Default Apps, and scroll to "Web Browser". If you try to select Chrome from the dropdown here and it does not appear to select (as seems to be the bug), choose Internet Explorer from the dropdown (notice that it selects), then reattempt to select Chrome from the dropdown. This appears to solve the bug

alancussen

Posted 2016-04-25T01:17:31.617

Reputation: 1

What are the steps to set Chrome as a default browser instantly? – alljamin – 2017-02-16T23:22:00.907

On Windows 10, open Settings -> System -> Default Apps, and scroll to "Web Browser". If you try to select Chrome from the dropdown here and it does not appear to select (as seems to be the bug), choose Internet Explorer from the dropdown (notice that it selects), then reattempt to select Chrome from the dropdown. This appears to solve the bug. – alancussen – 2017-02-18T00:39:17.797

Add this to your answer. – alljamin – 2017-02-18T02:42:32.383

5I think he/she was wanting to do this programmatically rather than manually. – Sam – 2017-04-05T23:43:40.870