I am using the following to login automatically to a remote server and then run commands listed in a commands.txt
, like this:
C:\path\to\putty.exe -load "[Sessionname]" -l [user] -pw [password] -m C:\path\to\commands.txt
commands.txt
contains the following:
ps -elf|grep 'sometext'
However, when I try to do so a new window for PuTTY appears, but it closes and exits instantly after login. As a result, I cannot see the output of the command(s).
I don't understand what's going on here. Am I wrong in my approach or do I need to take more steps to make the PuTTY window pause for some time before exiting?