1
votes

This is the first time that I am trying to write a "plink" command that will connect to a device and to have a remote command executed afterwards. And I am blocked so far.

Here is the command I have tried.

plink -v device ( execute shell; whoami)

I was expecting the full command process finished right away, but somehow, it hangs. here is the screenshot after I have run the above command,

plink -v device ( execute shell; whoami) 
Opening serial device COM1
Configuring baud rate 115200
Configuring 8 data bits
Configuring 1 data bits
Configuring no parity
Configuring XON/XOFF flow control

And after i have pushed the extra "Enter" key from my keyboard, then I see the popup of device name, which means the connection part is ready,

plink -v device ( execute shell; whoami) 
Opening serial device COM1
Configuring baud rate 115200
Configuring 8 data bits
Configuring 1 data bits
Configuring no parity
Configuring XON/XOFF flow control

FX04DN4N16000408  #

What I don't understand is why do I need to run this extra manual step ?

Thanks,

Jack

1

1 Answers

2
votes

Specifying a command on Plink command-line (or with -m switch) works with SSH only, not with serial (or other) connections. The reason is that those connections have no interface for executing a command. They only have input/output. So you can use input redirection instead, like:

plink.exe ... < commands.txt

or

(
  echo your command 1
  echo your command 2
  echo your command 3
) | plink.exe ...