In Windows you can register “url handlers”. These are programs that are run when you try to open a URL (via Start->Run for example). “http://” for example is registered to Internet Explorer by default. “telnet://” also works. This is especially useful in combination with the URL-field of KeePass. Double-clicking on this field tries to “open” the specified URL.
However, “ssh://” is not a standard registered protocol. I’d like Putty to handle this. Also, “telnet://” gets you the standard windows telnet client instead of putty. Putty can be called with command line arguments. Supplying the “telnet://” url as a parameter works, but “ssh://” does not.
Hence, I wrote a very small wrapper program to accept “ssh://” URL’s and convert them to Putty command line arguments:
- Source code in C: ssh-to-putty.c
- Compiled Windows executable: ssh-to-putty.exe
- Registry commands to set putty as telnet-handler: putty telnet url handler.reg
- Registry commands to set the wrapper as ssh-handler: putty ssh url handler.reg
Some notes:
- The registry commands assume Putty and the wrapper are installed in C:\Progs\SSH. If this is not the case, you need to change the .reg-files accordingly
- The wrapper-program assumes putty.exe to be in the same directory as itself
Bjørn says:
Just a tip:
You should “assume” that people just install putty with the default settings.
Assuming anything else, will render it useless unless people edit the reg-files.
Cheers for making the regfiles tho
2009-07-28, 11:58Niobos says:
Bjørn,
I agree. But since putty is normally downloaded as a simple .exe without installer, there is no default installation path. Also, editing a text-file is not very hard.
Niobos
2009-07-28, 18:03Felix says:
Nice work!
Two notes:
1) I had to add the directory that contains putty.exe and ssh-to-putty.exe to the PATH variable to make it work. Before that, ssh-to-putty could not find putty, even though both files were located in the same directory.
2) It would be nice if the ssh-to-putty window would close after starting putty.
Anyway, thank you very much
Best regards
2009-08-26, 10:17Felix