我有一个非常简单的批处理脚本:
@echo off
if %1 == a goto AA
if %1 == b goto BB
goto end
:AA
echo a
goto end
:BB
echo b
goto end
:END
echo on
如果我用参数调用它test.bat a
,我会得到我所期望的,但如果我不带任何参数调用它test.bat
,我会得到goto was unexpected at this time.
并且有问题的行是if %1 == a goto AA
.
为什么?