老实说,我不希望在这里得到令人满意的答案。这些命令不能被调用,仅此而已(据我所知,唯一不能与 call 一起使用的命令)。以下是他们输出的几个例子:
C:\Windows\system32>call @if a==a echo called
',' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\system32>call (@if a==a echo called)
';' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\system32>call if a==a echo called
'if' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\system32>call for %a in (1) do @echo called
'for' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\system32>call @for %a in (1) do @echo called
'+' is not recognized as an internal or external command,
operable program or batch file.
C:\Windows\system32>call (@for %a in (1) do @echo called)
';' is not recognized as an internal or external command,
operable program or batch file.
我有些怀疑,IF 和 FOR 实际上不是“真正的”命令——它们只是决定是否将命令提示符控制传递给它们后面的行(或括号块),这会混淆调用。无论如何,即使在调用 FOR 或 IF 时检测到语法错误:
C:\Windows\system32>call (@if a= echo called)
= was unexpected at this time.
C:\Windows\system32>call (for %a (1) do echo called)
(1 was unexpected at this time.
所以至少解析完成了。