The batch parser concatenates the first tokens after the IF
.
To gain an insight you can use the cmdcmdline
variable.
From a batch file
@echo off
echo pipe | if defined 1 geq 1 echo %%cmdcmdline%%
In the output you can see that defined
and 1
are concatenated, so this is the cause for the strange results
C:Windowssystem32cmd.exe /S /D /c" if defined1 geq 1 echo
%cmdcmdline%"
When you test this from the command line you need to modify the %%cmdcmdline%%
to %^cmdcmdline%
as the cmd-parser works a bit different with percent expansions.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…