So here's some good information I think some people can benefit from. In this thread I will explain how you can register a protocol and assign it a default application that is able to interpret how this protocol is to be dealt with.
What is a protocol? A protocol is a method used to send/transmit, and receive information over a connection. Typically the most common protocols that most know of would be IRC, HTTP, HTTPS (SSL), FTP, MAILTO, etc...
In order to use a specific protocol however, it has to be registered. If for some reason a protocol is not registered, and you type that into the addressbar of explorer.exe or a web browser for instance, it can't do anything, because it doesn't recognize it, and will not know how to handle it.
If it does recognize the protocol, let's see an example:
It will be able to interpret how to handle everything accordingly.
Note: I just typed that in explorer, I didn't even use a webbrowser but you can see that it knew how to handle the file transfer protocol here.
When a protocol is registered however, you can specify a program that is meant to be ran for dealing with this location using the specified protocol. This program should have the means to know how to deal with the protocol for starters, but it should also be a command line utility that can accept the address in %1, the first argument other than %0 which is always the program itself.
In the Windows operating system, registration of a certain protocol is done by the system itself. Setting a web browser as the default program to open a link for example, will invoke the system to register usually HTTP, HTTPS/SSL, and FTP, with that program. Same thing with email client programs, only with the MAILTO protocol.
You can register your own protocols by merging a .reg file with the Windows registry too:
Code:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\PN]
@="URL:PN Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\PN\shell]
[HKEY_CLASSES_ROOT\PN\shell\open]
[HKEY_CLASSES_ROOT\PN\shell\open\command]
@="\"C:\\Program Files\\MyProgram.exe\" \"%1\""
edit: "open" and "command" are basically like
verbs if you know what these are. "runas" is another common one which is used, but that's just some background information I've decided to add in here. With the open
verb essentially this happens when something is opened obviously, in this case, it's an address, which will be recognized if that protocol is registered. The system effectively uses this registry entry to find "open" and it seeks the command that we've told it to run whenever the "open" verb matches the operation taking place I guess is how I would describe it. So as you can see, we pass %1 (which is the protocol address), and invoke it as a first argument for our program, namely "MyProgram.exe" in this case, which hopefully can understand what to do with this command line argument to execute in the way we intend, in order to do something with handling this protocol address.
Where:
PN = The protocol name
The only other thing to modify is the path to the program you want to use as the default handler for the protocol.
Note: ONLY modify this part in red:
@="\"C:\\Program Files\\MyProgram.exe\" \"%1\"". Everything else should stay as is, because we want to pass the actual address as an argument to the param here indicated by the %1.
Also, keep in mind that each backslash needs to be escaped with a backslash, if it's a new "level" in the directory structure of the filepath itself.