我試圖在很多地方找到解決方案,但找不到具體答案。批處理程序在變量中查找字符串
我正在創建批處理腳本。 以下是到目前爲止我的代碼
@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"
)
OUTPUT:
FINDSTR: Cannot open already
The syntax of the command is incorrect.
我試圖查找單詞 '已經' 變量 'ras基因',
的問題似乎是在 FINDSTR/C: 「%RAS%」 「已經」
我試着用 findstr「%ras%」「已經」 但這不起作用。
非常聰明替換字符串絕招!我已經看到了很多與噸find'和類似的例子',但這是非常快,乾淨,易於理解! – Gruber