我在将变量中的字符串与批量的实际字符串进行比较时遇到了很多麻烦。这是脚本:
set failure=0
for /F "usebackq delims=" %%L in (`"wmic PRINTER where name='10.146.2.52 - HP Color LaserJet CP5225n' GET Name 2>&1"`) do (
::Quotes around variable seem to have no effect. Same result w/ or w/o them.
if /I "%%L"=="No Instance(s) Available." set failure=1
echo %failure% %%L
)
这是输出:
为什么 if 语句会失败?这些值显然匹配。请帮忙!!