How to set program.exe as a default browser in Windows 10?

Question:

I need to set my program.exe as a default browser in Windows 10.
I can’t find the way how to do that. Even with regedit.

Please give some advice how to do that?

Thanks!

Asked By: Quanti Monati

||

Answers:

I assume you register yourself as the default handler of the HTTP & HTTPS progids? That will take care of anything before Windows Vista.

You should also register yourself as a default program but as noted in the “Becoming the Default Browser” section, this will simply display a notification on newer versions of Windows.

The file type and URI association model changed in Windows 8:

Apps are no longer able to programmatically set themselves as the default handler for a file type or URI. Instead, now the user always controls what the default handler is for a file type or URI scheme.

In Windows Vista to Windows 8 you can call IApplicationAssociationRegistrationUI::LaunchAdvancedAssociationUI and let the user pick your application as the default. In Windows 10 even this API has been restricted and just tells the user to manually perform the steps in the Settings app.

If no application is registered for a specific type you will become the default but that is never the case with browsers.

The Windows 10 changes were announced here.

Answered By: Anders

The only complete documentation on how to do that seems to be this blog post (archive link). I was able to install a script file as the default browser using this method.


I created the following Batch script to automate the install/uninstall process of the neccessary registry keys somewhat. You can call it with parameters install <name> <command-to-open-exe> <icon?> to register a new browser, and later with uninstall <name>
to remove it.

Example Firefox Portable (including EXE icon): script.bat install FirefoxPortable ""C:whateverfirefox.exe" "%1"" "C:whateverfirefox.exe,0" and script.bat uninstall FirefoxPortable

@echo off

IF "%1" == "uninstall" (
    IF "%2" == "" (
        echo Usage: uninstall ^<name^>
    )
    IF NOT "%2" == "" (
        reg delete "HKCUSOFTWARERegisteredApplications" /v "%2" /f
        reg delete "HKCUSOFTWAREClientsStartMenuInternet%2"  /f
        reg delete "HKCUSOFTWAREClasses%2HTM" /f
    )
)

IF "%1" == "install" (
    IF "%2" == "" (
        echo Usage: install ^<name^> ^<command?^> ^<icon?^>
    )
    IF NOT "%2" == "" (
        reg add "HKCUSOFTWARERegisteredApplications" /v "%2" /t REG_SZ /d "SoftwareClientsStartMenuInternet%2Capabilities" /f


        reg add "HKCUSOFTWAREClientsStartMenuInternet%2" /t REG_SZ /d "%2" /f

        reg add "HKCUSOFTWAREClientsStartMenuInternet%2Capabilities" /v "ApplicationDescription" /t REG_SZ /d "%2" /f
        reg add "HKCUSOFTWAREClientsStartMenuInternet%2Capabilities" /v "ApplicationIcon" /t REG_SZ /d "%4" /f
        reg add "HKCUSOFTWAREClientsStartMenuInternet%2Capabilities" /v "ApplicationName" /t REG_SZ /d "%2" /f

        reg add "HKCUSOFTWAREClientsStartMenuInternet%2CapabilitiesFileAssociations" /v ".htm" /t REG_SZ /d "%2HTM" /f
        reg add "HKCUSOFTWAREClientsStartMenuInternet%2CapabilitiesFileAssociations" /v ".html" /t REG_SZ /d "%2HTM" /f

        reg add "HKCUSOFTWAREClientsStartMenuInternet%2CapabilitiesStartmenu" /v "StartMenuInternet" /t REG_SZ /d "%2" /f

        reg add "HKCUSOFTWAREClientsStartMenuInternet%2CapabilitiesURLAssociations" /v "http" /t REG_SZ /d "%2HTM" /f
        reg add "HKCUSOFTWAREClientsStartMenuInternet%2CapabilitiesURLAssociations" /v "https" /t REG_SZ /d "%2HTM" /f

        reg add "HKCUSOFTWAREClientsStartMenuInternet%2shellopencommand" /t REG_SZ /d "%2HTM" /f


        reg add "HKCUSOFTWAREClasses%2HTM" /t REG_SZ /d "%2 Handler" /f
        reg add "HKCUSOFTWAREClasses%2HTM" /v "AppUserModelId" /t REG_SZ /d "%2" /f

        reg add "HKCUSOFTWAREClasses%2HTMApplication" /v "AppUserModelId" /t REG_SZ /d "%2" /f
        reg add "HKCUSOFTWAREClasses%2HTMApplication" /v "ApplicationIcon" /t REG_SZ /d "%4" /f
        reg add "HKCUSOFTWAREClasses%2HTMApplication" /v "ApplicationName" /t REG_SZ /d "%2" /f
        reg add "HKCUSOFTWAREClasses%2HTMApplication" /v "ApplicationDescription" /t REG_SZ /d "" /f
        reg add "HKCUSOFTWAREClasses%2HTMApplication" /v "ApplicationCompany" /t REG_SZ /d "%2" /f

        reg add "HKCUSOFTWAREClasses%2HTMDefaultIcon" /t REG_SZ /d "%4" /f
        reg add "HKCUSOFTWAREClasses%2HTMshellopencommand" /t REG_SZ /d "%~3" /f
    )
)

Answered By: aperson