How would one go about creating a "custom protocol?" I know you can create a URL protocol by adding a number of registry entries to HKEY_CLASSES_ROOT, but that seems to only work in a browser. I need for it to work in Windows Explorer also.
I know that I can write a client/server sort of interface, but I think that is overkill for my client's needs (and budget).
Long story short...
tbwx:<row_id>
It sounds fairly simple (or so I thought). Any ideas?
Thanks
A very practical version of an Action Menu Item (AMI) is a variant that will run an application or a script on your local computer. For this to work you need to set up a connection between your browser and the script or application you wish to run. This link is called a custom browser protocol.
You can create a custom protocol as long as you add a URL Protocol
value of type REG_SZ
to a class's key. It doesn't need an actual value, just needs to be present. Here's a simple example of an "Echo Protocol" I just created which works in Windows Explorer.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\echo]
"URL Protocol"=""
@="Echo Protocol"
[HKEY_CLASSES_ROOT\echo\shell]
[HKEY_CLASSES_ROOT\echo\shell\open]
[HKEY_CLASSES_ROOT\echo\shell\open\command]
@="C:\\WINDOWS\\SYSTEM32\\CMD.EXE /Q /C (echo %1) && pause"
Then if you type in Windows Explorer (or Run menu) for the path:
It should even work from a browser as well, you'll just need to confirm like any other protocol:
It should run the command:
I've found it will also work in the keys HKCU\Software\Classes
and HKLM\Software\Classes
too. It isn't listed in the Control Panel\Programs\Default Programs\Set Associations
list however. Other keys might need to be updated or it would have to be registered with Windows somehow.
This seems to continue to work all the way up to Windows 10 and possibly 11.
The Registering an Application to a URL Protocol article details the process. There is a utility on GitHub that can be used to register custom URL protocols. The source code is provided.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With