How to Save the Execution Log When We Run a Command Using Putty/Plink

Automatically execute a command after PuTTY login and provide it with an input

The file that you pass using -m switch can contain shell commands only. You cannot use it to provide an input to those commands. For that would would have to use remote shell features, like an input redirection – if you really need to use PuTTY.


But in general, to automate command execution, you should use Plink (part of PuTTY suite).

With Plink, you can do this:

(
echo input line 1
echo input line 2
) | plink.exe -ssh user@example.com -pw password command

Or an equivalent:

plink.exe -ssh user@example.com -pw password command < `input.txt`

Where the input.txt contains the input for the command:

input line 1
input line 2

problem executing plink(putty) command

Try running it like this:

c:\plink.exe -l userId -pw psw remote_host C:\goto\test.bat


Related Topics



Leave a reply



Submit