send commands to serial port using putty and .bat file

user3812823 picture user3812823 · Jul 7, 2014 · Viewed 14.8k times · Source

I would like to send following AT commands automatically by creating a .bat file using PuTTy.

AT

ok

AT+CPIN = 1234

ok

I can do it manually so far. But I would like to do it automatically by executing the above commands by just clicking on a batch file. Can someone please help me with the commands to prepare my .bat file? Thanks in advance!

Answer

nephi12 picture nephi12 · Jul 7, 2014

try something like this:

commands.bat:

@echo off
echo AT
timeout /t 1 /nobreak >nul 2>&1
echo AT+CPIN = 1234
timeout /t 1 /nobreak >nul 2>&1
pause >nul 2>&1

send.bat:

commands.bat | putty -load test

where send.bat and commands.bat are in the same directory, and you execute send.bat