PuTTY command line automate serial commands from file

Rob picture Rob · Feb 15, 2016 · Viewed 22.3k times · Source

I am trying to connect to a serial port and send a series of commands from a file.

Firstly I have mananged to connect via the following:

PuTTY.exe -serial COM3 -sercfg 57600,8,n,1,N

E.g. I have a file called commands.txt with a series of serial commands I wished to be sent.

I tried the following however it failed to work:

PuTTY.exe -serial COM3 -sercfg 57600,8,n,1,N -m commands.txt

Any help is greatly appreciated.

Answer

SachaDee picture SachaDee · Feb 15, 2016

Try like this :

for /f "delims=" %%a in ('type commands.txt') do PuTTY.exe -serial COM3 -sercfg 57600,8,n,1,N -m %%a