Good day all.
I am hoping that someone here might be able to give me some ideas on how best to carry out the following.
I have a piece of equipment and all changes to the settings have to be manually typed via serial terminal, in my case I use PuTTY for this.
As there is no software for this equipment, I wanted to try and write a little windows batch script that would send the serial commands for me.
Unfortunately I can't seem to get my batch script to work correctly when sending the commands over serial via Plink (PuTTY Link).
If I do everything manually via PuTTY it works, for example. I type *IDN? followed by the enter key, the command is sent and I get the desired response with serial number, firmware, etc.
The same is true for any following commands.
However my batch script works of sort, but fails when sending the serial commands.
The first command is executed, but all following commands come back with an error.
This is because the serial command(s) being sent are slightly changed. This was confirmed by checking with a logic analyzer.
Snippet of the batch file.
@echo off
cls
set /p ComPortNumber=Enter Serial Port Number:
(
echo *IDN?
timeout /t 1 > nul
echo SETTINGS
timeout /t 1 > nul
) | "C:\Program Files\PuTTY\plink.exe" -v -serial COM%ComPortNumber% -sercfg 9600,8,1,n,X
The above is sending the commands, but is adding a Space and Line feed.
For example again.
Manual input via PuTTY would result in the serial output of *IDN?\r
My batch script would result in the serial output of *IDN \r\n
I am not sure how to fix this issue, and welcome any suggestions.
Thanks for your time.
Best Regards.