我已经对此进行了一段时间的修补,但我无法在脚本中使其完全工作。如果我单独运行命令,它们将作为expected...any帮助工作,我将非常感激。提前谢谢你!
cls
@echo off
set celValue=
for /f "tokens=3 delims=: " %%a in ('netsh mbn show connection interface^="Cellular"^| findstr
"Interface"') do set celValue=%%a
if "%celValue%"=="Connected" (for /f "tokens=3 delims=: " %%i in ('netsh interface ip show config
name^="Cellular"^| findstr "IP Address"') do echo Cellular IP: %%i) else (echo Cellular not
connected)
pause发布于 2020-07-17 00:07:06
我无法测试此设备,因为此设备上没有宽带连接。所以你需要为我们做测试。因此,除了注释中显示的esacpaing问题之外,带括号的代码块的格式也不正确。
cls
@echo off
set celValue=
for /f "tokens=3 delims=: " %%a in ('netsh mbn show connection interface^="Cellular" ^| findstr /I "Interface"') do set celValue=%%a
if "%celValue%"=="Connected" (
for /f "tokens=3 delims=: " %%i in ('netsh interface ip show config name^="Cellular" ^| findstr /I "IP Address"') do (
echo Cellular IP: %%i
)
) else (
echo Cellular not connected
)
pausehttps://stackoverflow.com/questions/62937119
复制相似问题