I need to execute one or more commands via COM port (from console) on an embedded Linux device. I am trying to use plink on a Windows machine but it doesn't work.
I've tried different cases, one of them is:
echo "mkdir /test" | plink -batch -serial \\\\.\\com4 -sercfg 115200,N,8 -l root
I have a couple of problems:
echo.
to send empty line = Enterecho
to send the loginecho "foo"
, you get "foo"
, not foo
. So you might need echo mkdir ...
, not echo "mkdir ..."
.plink
to close it. And as the serial connection is not really a connection, it cannot be closed remotely (the way an SSH server can close the connection, when you send an exit
command). So all you can probably do is to kill the plink
, e.g. using taskkill
.(
echo.
echo username
echo mkdir /test
timeout /t 5 > nul
taskkill /f /im plink.exe > nul
) | plink ...