Bat Open/Write/Read/Close Serial port for AT modem

  at-command, batch-file, modem, serial-port, windows

i have a little issue with a cellular modem. i need to obtain it’s IMEI number automatically on windows and save it as txt file. So, for this is needed to:

  1. -Open serial port

  2. -Send command > AT+CGSN

  3. Read serial port

  4. make txt file

  5. Close serial port

So…

@echo off
rem Searching modem's port com. 
chgport | find "Devicecocdcacm0" 
rem This return: COM14 = Devicecocdcacm0


mode COM14 BAUD=115200 PARITY=n DATA=8 STOP=1 XON=ON

i don’t know if am i doing it good. thanks for any help!

Source: Windows Questions

LEAVE A COMMENT