Your commands.txt
file is just a mess.
I assume you want to send set_zero
command, not echo set_zero
command, so put set_zero
to the file, not echo set_zero
.
Though if you need to pause between the commands, a simple input redirection won't help, as you cannot use timeout
command then. You want to execute timeout
command locally, while you are sending it to the serial port. Your code is actually correct, had you used it as a script that generates an input for the plink
. But for that, you need to use |
not <
.
This might do what you want:
(
echo set_zero
timeout /t 3 /nobreak >nul 2>&1
pause >nul 2>&1
echo set_a 65535
pause >nul 2>&1
timeout /t 3 /nobreak >nul 2>&1
echo set_a 0
timeout /t 3 /nobreak >nul 2>&1
pause >nul 2>&1
) | plink -load test
Though, you might want to move pause
only after plink
:
(
...
echo set_a 0
timeout /t 3 /nobreak >nul 2>&1
) | plink -load test
pause >nul 2>&1
Alternativelly, as @Appleodity already suggested, rename commands.txt
to commands.bat
and use it like:
commands.bat | plink -load test
Again, maybe like this (after moving pause
from commands.bat
):
commands.bat | plink -load test
pause >nul 2>&1
2What does the serial port connect to? What are you trying to accomplish? Please do not respond in comments; [edit] your question to make it clearer and more complete. – Scott – 2018-10-15T03:51:16.520