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

1.5k views Asked by At

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!

2

There are 2 answers

0
Anders On BEST ANSWER

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.

0
aperson On

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:\whatever\firefox.exe\" \"%1\"" "C:\whatever\firefox.exe,0" and 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
    )
)