2014/06/06

putty commandline

putty.exe -load “session name”
putty.exe [-ssh | -telnet | -rlogin | -raw] [user@]host

What the -m does is, that it makes PuTTY instruct the SSH server to start that command(s) INSTEAD of shell.
So once your command finishes, so does the session.
So if you want to run shell after the cd, you need to add it explictly to your cmd.txt.
Also as you helped me to realise, the -m implies "nopty" mode. To use shell you need to override that using -t switch.
Alternativelly use KiTTY with its -cmd switch that does what you want (and does not need a temporary file).