PuTTY Tools and Tips

These tools and tips are useful to users of PuTTY, the awesome terminal emulator and secure-shell client for Microsoft™ Windows™.

Send-to Host Context Menu

This trick lets you right-click on any file (or multiple files) or folder, click Send To, then select server1 and have the files magically transferred to your home directory on the target ssh server. You can even put the shortcut on your desktop and drag files onto it to send them.

This trick can also be achieved using things like WinSCP, but sometimes you don't want to have to choose the host within WinSCP every single time you do this, and hard-coding a few hosts can boost your efficiency. This works best when you've setup key-based authentication.

  1. Install PuTTY and pscp in particular.
  2. Save (right-click and select "save link/target as") this batch file somewhere, perhaps where you've installed PuTTY.
  3. Copy the batch file to reflect the hostname, something like sendto.server1.bat
  4. Edit the batch file and change the value of HOST to your hostname, eg:
    set HOST="server1"
    
  5. In Explorer, right-click on the batch file and choose copy.
  6. Click on Start, choose Run... and type "%USERPROFILE%\sendto" or "shell:sendto".
  7. Right-click in the Sendto folder and choose Paste Shortcut.
  8. Rename the shortcut to something like Server1.

There is another way to do this using VBScript, that you might prefer.

Desktop Network Drive Icon

  1. On your desktop, place a copy of the shortcut created in the previous section, and rename it to something like Send to Server1.
  2. Right-click on the shortcut and change the icon to look like a network drive.
Now, right-click on a file somewhere, choose Send To and you should see your servername. After selecting it from the menu, your file(s) should start transferring. Alternatively, drag the file(s) to the shortcut you made on the desktop.

A ssh:// URL Type

Sometimes it's useful to have a webpage of links like ssh://server1/ where you can click to whatever you need to get to in a hurry. I often do this on Wikis I use for support documentation, so that I can quickly link directly to the host in question from the doco that talks about it.

This trick is achieved by creating a registry entry pointing to the PuTTY binary. The only problem is, when putty is run this way, it can't extract the hostname from the string it's given, because it's run like this:

  putty ssh://server1
instead of
  putty server1
PuTTY can't handle the URL prefix. So to work around it, we need a batch file that can strip off the ssh:// part. To implement this solution:
  1. Save the batch file into the folder where PuTTY is installed, and rename it as putty.url.bat. Check that it has the correct path to the putty.exe binary.
  2. Save the registry file somewhere, open it in notepad to check that I'm not giving you a malicious registry entry, rename it to putty.url.reg, double-click it and answer the questions in the affirmative.
At this point you should be able to click on an SSH link such as this one: ssh://fred@localhost/. It's unlikely to connect but you should get a "Connection refused" error from PuTTY when it tries. Now, try Start → Run... and type ssh://user@servername and see if it works for you.


No doco, no warranty, feedback welcome.