I start most of my SSH connections with a windows command like this

cmd://"C:\Program Files\PuTTY\putty.exe" -ssh root@xxx.xx.xxx.xx

I assume this defaults to port 22. Now I need to connect on a different port. I tried

cmd://"C:\Program Files\PuTTY\putty.exe" -ssh root@xxx.xx.xxx.xx:xxx

(port number on the end) but it won't allow the connection. I know the port number and IP are correct because if I fire up PuTTY and start a session with these details I can get in fine.

p.s. If this is the wrong stackexchange for this question please don't destroy me, I did look for quite a long time before deciding to post here.


Ok - I'm embarrassed. I just found the -P option which does exactly what I want.

cmd://"C:\Program Files\PuTTY\putty.exe" -ssh root@xxx.xx.xxx.xx -P xxx

is the correct syntax.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.