Question

I have made a program to handle http links. How do I set the default browser to my exe? I only need to change the http protocol, not file associations. I have already setup command line argument handling. I do not want to use a .reg file since it asks the user about adding keys.

Was it helpful?

Solution

You could run regedit in silent mode ("/S").

Or run cmd script:

reg add HKEY_CLASSES_ROOT\http\shell\open\command /ve /d "path\to\app \"%1\"" /f

(for registered http handler - overwrite an existing empty parameter in a "\shell\open\command" key).

Update Also you can experiment with default browser (HKEY_CURRENT_USER\SOFTWARE\Clients\StartMenuInternet) as per MSDN article. But you'd also handle local files as well.

OTHER TIPS

@TomTom Sorry, I don't have enough rep to comment. ;)

Just because Firefox and a couple of other browsers are popular does not mean that it is somehow "special" in that it can ask you if you want to change the setting. There is NO reason why a custom-made application cannot do the same.

@msbg, since you commented there, you likely already found your answer at how do i change default browser using c# or batch file

There's another answer at How to find all the browsers installed on a machine which refers to http://msdn.microsoft.com/en-us/library/dd203067%28VS.85%29.aspx

You do not. This is not a program specific Setting, it is a System wide.

What you CAN do is start a specific exe (the browse) and give it the URL as Parameter. But generally, sorry, this is a System wisde Setting (not even user) iirc.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top