if [/i] StringToCompare1 == StringToCompare2 (commandA) else (commandB)
if errorlevel 1 (commandA) else (commandB)
if %errorlevel% == 1 (commandA) else (commandB)
if exist Filename (commandA) else (commandB)
if defined VariableName (commandA) else (commandB)
There are a few syntax to choose from in an if
statement. We will use if string1==string2
as an example.
if string1==string2 commandA
if string1==string2 (commandA)
if string1==string2 (commandA) else (commandB)
if string1==string2 (commandA) else commandB
if string1==string2 (commandA)else (commandB)
if string1==string2 (commandA)else commandB
if string1==string2 (
commandA
)
Or
if string1==string2 (
commandA
) else (
commandB
)
There are still some extra syntaxes available.