如何“回显”应该扩展环境变量本身的(环境)变量的值?
示例BAT:
echo OFF
SETLOCAL
echo running test ...
set /a "YesPleaseContinue=0"
IF defined windir (
set /a "YesPleaseContinue=1"
)
IF %YesPleaseContinue% GEQ 1 (
set MyCustomVar=%WinDir%\System32\regsvr32.exe
echo DEBUG1: %MyCustomVar%
) ELSE (
echo condition not met
)
echo DEBUG2: %MyCustomVar%
timeout 120
这将产生以下输出:
running test ...
DEBUG1:
DEBUG2: C:\WINDOWS\System32\regsvr32.exe
为什么“ echo”在带有“ DEBUG1”的行中输出 empty 内容?