19

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

Jason S
  • 184,598
  • 164
  • 608
  • 970
Jan Bannister
  • 4,859
  • 8
  • 38
  • 45
  • See [here](http://blogs.msdn.com/b/noahc/archive/2006/10/19/register-a-custom-url-protocol-handler.aspx) for an example. – Preet Sangha Aug 28 '13 at 10:42
  • here's the same: https://stackoverflow.com/questions/80650/how-do-i-register-a-custom-url-protocol-in-windows – sercxjo Oct 15 '21 at 07:45

4 Answers4

20

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.

Richard Szalay
  • 83,269
  • 19
  • 178
  • 237
  • Thanks for that Richard, ftype looks like just the thing. However, when I create a binding like: ftype ssh=c:\putty %1 When I try and run 'ssh:' I get 'Access Denied'... – Jan Bannister Apr 28 '09 at 10:32
  • I found that in Vista I'm getting 'File not found' depending on user administrative rights and UAC turned on or off. http: and mailto: as protocols doesn't have this problem – Goran Peroš May 05 '09 at 13:53
  • 3
    Unfortunately, ftype on the command line alone will give "access is denied". You need to also add the blank "URL Protocol" key listed in the registry example. The linked MSDN article covers this. – studgeek Apr 22 '11 at 14:27
12

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.

Chris S
  • 64,770
  • 52
  • 221
  • 239
  • 4
    This works great, but the protocol is passed also. So in your example the app is send "alert:some message". Any tips/thoughts on how to strip the alert: off before the app receives it? I have tried string substitution like %1:alert:=%, but it doesn't seem to work. – studgeek Apr 22 '11 at 14:45
  • [this stackoverflow article](http://stackoverflow.com/questions/23334946/cmd-batch-registry-string-replace-not-working-as-expected/23339563#23339563) has the answer. – Air2 Jun 03 '14 at 13:58
2

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).

Jason Musgrove
  • 3,574
  • 19
  • 14
0

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).

Clare Macrae
  • 3,670
  • 2
  • 31
  • 45