cmd.exe 中的
在Windows命令提示符下:
D:> echo %undef%
%undef%
D:> type undef.bat
echo %undef%
D:> undef
D:> echo
ECHO is on.
我的问题是,为什么在命令行上,像%undef%
这样的未定义环境变量被扩展为%undef%
,而在BAT文件中却被扩展为空字符串?
for /f "tokens=* delims=" %S IN ('help^|find /i "for "') do echo %S
与
蝙蝠文件中的for /f "tokens=* delims=" %%S IN ('help^|find /i "for "') do echo %%S
了解:
@set 1=
@echo %1
@echo %1%
@set 1=interactive only
@echo %1%
cmd.exe中返回:
%1
%1%
interactive only
但在batfile中,当运行时带有一些选项(例如:"第一"第二"(
"first"
"first"
"first"
它正在为参数转义(对于get>9参数,使用shift
命令(