0

I am trying to create a script to login to a remote server and run a command. The script is as follows

plink.exe UserName@ServerIP -pw PASSWORD -batch -m PATHTOFILEWITHSCRIPT.txt

PATHTOFILEWITHSCRIPT.txt has this line

debug software restart process user-id

The script when run logs into the server but does not run the command.

Any ideas?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Thanks Martin. For others looking for the answer this is the format that you need echo COMMAND | plink.exe UserName@ServerIP -pw PASSWORD -batch -ssh – user2009484 Nov 17 '21 at 18:29
  • Does this answer your question? [Executing command using Plink does not work, but does in PuTTY](https://stackoverflow.com/questions/46591648/executing-command-using-plink-does-not-work-but-does-in-putty) – Martin Prikryl Nov 17 '21 at 19:20

1 Answers1

-1

The format that is required is

echo COMMAND | plink.exe USER@SERVER -pwd PASSWORD -batch

where COMMAND is the command that you want to run after you log in