If
Performs conditional processing in batch programs. If the condition specified
in an if command is true, Windows NT carries out the command that follows the
condition. If the condition is false, Windows NT ignores the command.
if [not] errorlevel number command
if [not] string1==string2 command
if [not] exist filename command
Parameters
not
Specifies that Windows NT should carry out the command only if the condition
is false.
errorlevel number
Specifies a true condition only if the previous program run by CMD.EXE
returned an exit code equal to or greater than number.
command
Specifies the command that Windows NT should carry out if the preceding
condition is met.
string1==string2
Specifies a true condition only if string1 and string2 are the same. These values can be literal strings or batch variables (%1, for example). Literal strings do not need quotation marks.
exist filename
Specifies a true condition if filename exists.
More Information About If
If--Notes
If--Examples