Skip to content

Instantly share code, notes, and snippets.

@Eonasdan
Created March 7, 2022 14:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Eonasdan/fccfa49ff847747ade8935b7da089ba8 to your computer and use it in GitHub Desktop.
Save Eonasdan/fccfa49ff847747ade8935b7da089ba8 to your computer and use it in GitHub Desktop.
W10 change default browser to Chrome

Some times a group policy forces Edge to be the default browser and everytime you reboot you have to set it back to Chrome (or ff).

Save this script to your desktop as a vbs file and then run it after rebooting. Don't touch the keyboard or mouse during this process.

Lifted from SO

Set WshShell = WScript.CreateObject("WScript.Shell")
' Open the default settings window
WshShell.Run "ms-settings:defaultapps"
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment