How can I add a custom url handler on Windows. Like iTunes itms://

自古美人都是妖i 提交于 2019-11-26 10:32:01

问题


I would like telnet://blah to open putty and not the native windows telnet client.

I don\'t even know what this \'feature\' is called under windows so I\'m having no luck find any information about it.

Thanks in advance, Jan


回答1:


If it's simple, you can do it via the command line:

ftype telnet # view current binding
ftype telnet=\path\to\putty.exe %1

Otherwise you'll need to use the registry as previously posted.




回答2:


It's a registry keys that provides the custom URI handlers.

Here's an article on it on MSDN, to quote some of it:

HKEY_CLASSES_ROOT
     alert
          (Default) = "URL:Alert Protocol"
          URL Protocol = ""
          DefaultIcon
               (Default) = "alert.exe"
          shell
               open
                    command
                         (Default) = "C:\Program Files\Alert\alert.exe" "%1"

That would you allow to do

alert:some message

And your application would obviously receive the "some message" as its argument.




回答3:


To change the telnet: protocol handler (or any other existing handler) on XP (may work for Vista - I haven't looked), go to Control Panel > Folder Options > File Types (Tab). Scroll down (not much, it's near the top) to find (NONE) URL:Telnet Protocol, and hit the "Advanced" button. From here on in, it's just like changing a file type association. Note that the target application needs to support the passing of the supplied URL as a parameter.

Unfortunately, the "New" button doesn't seem to allow the creation of new "URL" types, as it requires the entry of an extension. To create a new one, I've previously had to copy an existing entry from the registry (that is: find, export, edit in text editor, and re-import).




回答4:


You can use following script: https://gist.github.com/sbiffi/11256316

It associates telnet:// and ssh:// URLs to a script which parses the parameters in the URL and launches putty.

No need to change putty It also supports passing login (and password for ssh).



来源:https://stackoverflow.com/questions/796748/how-can-i-add-a-custom-url-handler-on-windows-like-itunes-itms

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!