我需要将我的 program.exe
设置为 Windows 10
的默认浏览器。
我无法找到如何设置的方法,即使通过 regedit
也不行。
请给予一些建议如何实现这个操作?
谢谢!
我需要将我的 program.exe
设置为 Windows 10
的默认浏览器。
我无法找到如何设置的方法,即使通过 regedit
也不行。
请给予一些建议如何实现这个操作?
谢谢!
我假设您已经将自己注册为HTTP和HTTPS progids的默认处理程序?这将处理Windows Vista之前的所有问题。
您还应该将自己注册为默认程序,但请注意,在“成为默认浏览器”部分中指出,这只会在较新版本的Windows上显示通知。
文件类型和URI关联模型已在Windows 8中更改:
应用程序不再能够以编程方式设置自己为文件类型或URI的默认处理程序。现在,用户始终控制文件类型或URI方案的默认处理程序是什么。
在Windows Vista到Windows 8中,您可以调用IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI
并让用户选择您的应用程序作为默认项。在Windows 10中,即使使用此API也已受到限制,并且仅告诉用户手动执行Settings应用程序中的步骤。
如果没有为特定类型注册应用程序,则您将成为默认值,但浏览器永远不会出现这种情况。
Windows 10的更改在此处宣布。
install <name> <command-to-open-exe> <icon?>
来注册一个新的浏览器,稍后使用uninstall <name>
将其删除。script.bat install FirefoxPortable "\"C:\whatever\firefox.exe\" \"%1\"" "C:\whatever\firefox.exe,0"
和 script.bat uninstall FirefoxPortable
。@echo off
IF "%1" == "uninstall" (
IF "%2" == "" (
echo Usage: uninstall ^<name^>
)
IF NOT "%2" == "" (
reg delete "HKCU\SOFTWARE\RegisteredApplications" /v "%2" /f
reg delete "HKCU\SOFTWARE\Clients\StartMenuInternet\%2" /f
reg delete "HKCU\SOFTWARE\Classes\%2HTM" /f
)
)
IF "%1" == "install" (
IF "%2" == "" (
echo Usage: install ^<name^> ^<command?^> ^<icon?^>
)
IF NOT "%2" == "" (
reg add "HKCU\SOFTWARE\RegisteredApplications" /v "%2" /t REG_SZ /d "Software\Clients\StartMenuInternet\%2\Capabilities" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities" /v "ApplicationDescription" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities" /v "ApplicationIcon" /t REG_SZ /d "%4" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities" /v "ApplicationName" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities\FileAssociations" /v ".htm" /t REG_SZ /d "%2HTM" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities\FileAssociations" /v ".html" /t REG_SZ /d "%2HTM" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities\Startmenu" /v "StartMenuInternet" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities\URLAssociations" /v "http" /t REG_SZ /d "%2HTM" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\Capabilities\URLAssociations" /v "https" /t REG_SZ /d "%2HTM" /f
reg add "HKCU\SOFTWARE\Clients\StartMenuInternet\%2\shell\open\command" /t REG_SZ /d "%2HTM" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM" /t REG_SZ /d "%2 Handler" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM" /v "AppUserModelId" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\Application" /v "AppUserModelId" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\Application" /v "ApplicationIcon" /t REG_SZ /d "%4" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\Application" /v "ApplicationName" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\Application" /v "ApplicationDescription" /t REG_SZ /d "" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\Application" /v "ApplicationCompany" /t REG_SZ /d "%2" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\DefaultIcon" /t REG_SZ /d "%4" /f
reg add "HKCU\SOFTWARE\Classes\%2HTM\shell\open\command" /t REG_SZ /d "%~3" /f
)
)