比如说如果存在1.txt就把zb变量设为0然后显示
if exist 1.txt (
set zb=0
echo %zb%
)
运行后显示
ECHO 处于关闭状态
如果不去掉那个括号,我该怎么改?
setlocal enabledelayedexpansion
if exist 1.txt (
set zb=0
echo !zb!
)
endlocal
if exist 1.txt (
set zb=0
echo !zb!
)
endlocal
复合语句都得启用变量延迟吧?
温馨提示:答案为网友推荐,仅供参考