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:\Windows\system32\cmd.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.