ROM-DOS Internal Commands 4-39
IF
Batch File Command
The IF subcommand allows conditional execution of commands.
Syntax
IF [NOT] condition command
Remarks
The
condition
may be any one of the following:
ERRORLEVEL
number
string1
==
string2
EXIST [
drive:
][
path
]
filename
If the
condition
is true, then the
command
is executed. Otherwise the
command
is bypassed, and the next command in the batch file is
executed. The [NOT] option tests the opposite of any condition.
The ERRORLEVEL
number
is true if the last program to execute had an
exit code equal or greater than
number
. Using the [NOT] option with this
condition tests if the exit code is less than the
number
argument.
The condition
string1
==
string2
is only true when
string1
and
string2
are
identical. The strings must match exactly; uppercase/lowercase
mismatches are not allowed. Applying the [NOT] option creates a
condition that is true only when the strings are not identical.
The EXIST
filename
is true if the specified
filename
is found. Wildcard
characters are allowed in the
filename
. The [NOT] EXIST condition is
true when the
filename
cannot be found.