Serial port communication with Batch file

June 24, 2010 at 09:24:40
Specs: Windows XP

I currently have a program called serialterm.exe, which is designed to open a serial port an allows me to send data to a serial port. The program works well in Command line, but the minute I transfer the instructions to a batch file I have a few problems.
I need this batch file to enter in data, that the program will send to the serial port.

My current code:
serialterm.exe com1 9600 acsii empty no C:\test1.txt
Succesfully opens the program and then waits for some form of user input.
IS their any way to put code into the batch file that would allow user input to be simulated, or allow me to send data to a serial port.
All help well apreciated


See More: Serial port communication with Batch file

Report •


#1
June 25, 2010 at 04:04:30

Stated this is a Programming Forum question as there is no DOS in Windows XP, if serialterm.exe reads its input from stdin then it should accept data redirected from a text file holding the simulated user's input, e.g.

serialterm.exe com1 9600 ascii empty no C:\test1.txt < input.txt

or as a better alternative

echo.User's Text | serialterm.exe com1 9600 ascii empty no C:\test1.txt

Anyway a program is required to READ data from a serial port while to send text to a serial device batch commands suffice.

What you need is not fully clear however.


Report •

#2
June 28, 2010 at 17:13:24

Some programs don't work in batch files. Might use the program expect or there used to be a way to input keystrokes via dos. I forget how to do it anymore. Might have been only ibmdos that had it too.

I support the 'Everybody Draw Mohammed Day'. A religion doesn't deny my freedom.


Report •

Related Solutions


Ask Question