我在许多地方寻找解决方案,但找不到具体的答案。
我正在创建一个批处理脚本。 以下是我的代码:
@echo off
SETLOCAL EnableDelayedExpansion
cls
for /f "delims=" %%a in ('rasdial EVDO cdma cdma') do set "ras=!ras! %%a"
findstr /C:"%ras%" "already"
if %errorlevel% == 0
(
echo "it says he found the word already"
)
else
(
echo "it says he couldn't find the word already"
)
输出:
FINDSTR: Cannot open already
The syntax of the command is incorrect.
我正在尝试在变量 'ras' 中查找单词“already”,
问题似乎出现在 findstr /C:"%ras%" "already"
我尝试使用 findstr "%ras%" "already" 但这也不起作用。