![如何在 Windows 10 中自动将 Chrome 设置为默认浏览器](https://linux22.com/image/1491256/%E5%A6%82%E4%BD%95%E5%9C%A8%20Windows%2010%20%E4%B8%AD%E8%87%AA%E5%8A%A8%E5%B0%86%20Chrome%20%E8%AE%BE%E7%BD%AE%E4%B8%BA%E9%BB%98%E8%AE%A4%E6%B5%8F%E8%A7%88%E5%99%A8.png)
我已尝试在注册表项中设置默认值:
hkeycu>software>microsoft>windows>shell>associations>urlassociations>http
和https
。
尝试使用master_preference
文件。
尝试使用命令开关--make-default-browser
。
到目前为止这些都不起作用。
任何帮助都将不胜感激。对批处理文件、注册表项、文件替换/编辑等任何内容开放……基本上任何我可以自动化的内容。
答案1
你有没有尝试过做一个.vbs文件自动将 Chrome 设置为默认浏览器?
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
参考:用户“Raz”的评论在 OSD 期间将 IE 设置为 Windows 10 中的默认浏览器
答案2
要更改 Windows 10 中的默认浏览器,请尝试使用该工具SetDefaultBrowser – 根据命令行或脚本设置默认浏览器作者:Christoph Kolbicz。
以下对我来说很有效:
SetDefaultBrowser.exe HKLM "Google Chrome"
答案3
答案来自李女士在 2021-01-04 上,使用最新版 Windows 10 仍然有效。但是,我必须更新选项卡数量和睡眠命令。
更新后的步骤如下:
- 使用以下代码创建 VBS 文件
shell:startup
使用 [win]+[r] 或文件资源管理器打开文件夹- 将文件存储在启动文件夹中,以便每次重新启动时执行脚本
VBS 代码
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
答案4
这默认应用程序关联所有用户的信息都存储在以下文件中:
C:\Windows\System32\OEMDefaultAssociations.xml
找到使用edge的扩展或协议,并将其改为chrome,例如可以替换如下关联:
<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" />
要在 Chrome 中打开:
<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" />
您可以更改任何您想要的关联,但应保留其余部分。我有一个脚本,可从 S3 存储桶中拉取此文件并将其应用为机器配置过程的一部分。
例如,这是我的整个OEMDefaultAssociations.xml
文件:
<?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>