= , ; 等几个 符号在参数中 被当作 分隔符;
如果确实想把他们做为 参数 可以加 引号 ;再利用 %~1 来去掉引号'
比如 a;ta 将被当作 a 和 ta 两个参数;
!被吃掉是因为 在set赋值时启用了变量延迟;
可以把变量延迟 放到 set 后再启用;
具体代码可改为:
@echo off
set 111=%~1
set 222=%~2
set 333=%~3
setlocal EnableDelayedExpansion
echo !111!
echo !222!
echo !333!
aaa.bat "!a" "=a" ";a"
!a
=a
;a
=, ; and several other symbols are treated as separators in parameters;
If you really want to use them as parameters, you can add quotes; and then use %~1 to remove the quotes'
For example, a;ta will be treated as two parameters, a and ta;
! is eaten because variable delay is enabled during set assignment;
You can enable variable delay after the set;
The specific code can be changed to:
@echo off
set 111=%~1
set 222=%~2
set 333=%~3
setlocal EnableDelayedExpansion
echo !111!
echo !222!
echo !333!
aaa.bat "!a" "=a" ";a"
!a
=a
;a