0

so far what I have is

plink -batch root@1.1.1.1 -pw password COMMAND & plink -batch root@1.1.1.1 -pw password COMMAND

the problem is after the first command starts the batch waits for a response from the server to stop the session and go to the next command, I cant seem to find a way to get around this, I'm looking to have it send the command and immediately start the next command on the next server

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • In a batch file, every internal or external command is completely executed before the next one begins; to change that, take a look at the [`start` command](https://ss64.com/nt/start.html), which really just starts a command and immediately continues to the next (unless you explicitly specify the `/WAIT` option)... – aschipfl Jul 27 '21 at 09:47

1 Answers1

0

You can have the server itself execute the command in the background. So you can use the same techniques as with OpenSSH ssh, as you will be using server-side functionality, unrelated to the local SSH client you are using:
Getting ssh to execute a command in the background on target machine

So something like this:

plink -batch root@1.1.1.1 -pw password "nohup COMMAND > foo.out 2> foo.err < /dev/null &"

Or use local techniques to execute the command asynchronously:
Running Windows batch file commands asynchronously

So something like this:

start "title" /b plink -batch root@1.1.1.1 -pw password COMMAND
Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992