說實話,我不期望一個令人滿意的答案here.These命令不能被調用,就是這樣(據我所知,唯一的命令不能用於調用)。 這裏是他們的輸出幾個例子:爲什麼我不能在批處理和cmd中都不能調用「IF」和「FOR」?
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.
我有一些懷疑,認爲如果並沒有在事實上「真正的」命令 - 他們只是決定通過命令提示符控制線(或支架塊)在他們後面或不在後面,這使呼叫混淆。 反正即使這樣,當有語法錯誤在呼籲或者如果他們發現:
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.
所以至少解析完成。
這是令人着迷的 – user1167442