首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

你能在Windows10中用批处理脚本设置你的默认浏览器吗?

是的,你可以在Windows 10中使用批处理脚本来设置默认浏览器。下面是一个示例脚本:

代码语言:txt
复制
@echo off
setlocal

set browserPath="C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"

reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v ProgId /d ChromeHTML /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v ProgId /d ChromeHTML /f

reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v Hash /d "SHA256" /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v Hash /d "SHA256" /f

reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v HashAlg /d "SHA256" /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v HashAlg /d "SHA256" /f

reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v ProgId /d ChromeHTML /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v ProgId /d ChromeHTML /f

reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v ApplicationIcon /d %browserPath%,0 /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v ApplicationIcon /d %browserPath%,0 /f

reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice" /v FriendlyTypeName /d "Google Chrome" /f
reg add "HKCU\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice" /v FriendlyTypeName /d "Google Chrome" /f

endlocal

在上面的示例中,我们将默认浏览器设置为Google Chrome。你可以将browserPath变量的值更改为你想要设置为默认浏览器的浏览器的安装路径。

请注意,运行批处理脚本需要管理员权限。你可以将脚本保存为.bat文件,然后右键单击该文件并选择“以管理员身份运行”。

这是一个简单的示例,你可以根据需要进行修改和扩展。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

3分28秒

手把手教你搭建属于自己的网站(获取被动收入),无需服务器,github托管

领券