我有一个批处理文件,想要向串口COM1发送指令。我有以下代码,可以看到它成功设置了端口。但是它在那里停止了,在设置完串口后没有发送任何命令。
@ echo off
color b0
cls
echo.
echo.
echo. Enter IP address of the CSR on the site.
echo. Example: 11.152.34.82
set /p IP="IP Address: "
for /F "tokens=1,2,3,4 delims=." %%a in ("%IP%") do (
echo %%a, %%b, %%c, %%d
set last=%%d
set first=%%a
set second=%%b
set third=%%c
)
pause
cls
echo. select the technology you are trying to restore
echo. 1: AWS
echo. 2: PCS
echo. 3: LTE 1
echo. 4: LTE 2
set /p tech="Enter number: "
if "%tech%"=="1" goto AWS
if "%tech%"=="2" goto PCS
if "%tech%"=="3" goto LTE1
if "%tech%"=="4" goto LTE2
echo. Not found
goto commonexit
:AWS
set /a z=%last% - 2
set /a y=%last% - 25
goto UMTSScript
:PCS
set /a z=%last% -3
set /a y=%last% - 24
goto UMTSScript
:UMTSScript
mode COM1 BAUD=9600 Parity=n DATA=8
echo. command1 > COM1
echo. command2 > COM1
echo command1 > COM1
而不是echo.
。 - sojaset /p "=COMMAND1"<nul>\\.\COM1
- Squashman