gpt4 book ai didi

batch-file - 批处理文件不发送串行命令

转载 作者:行者123 更新时间:2023-12-02 14:46:07 24 4
gpt4 key购买 nike

我有一个批处理文件,我想将命令发送到串行端口 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 off

然后我会尝试:

@echo command1>COM1
@echo command2>COM1

如果这不起作用,我会尝试:

@echo command1|COM1
@echo command2|COM1

关于batch-file - 批处理文件不发送串行命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39795521/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com