Site hosted by Angelfire.com: Build your free website today!

MS-DOS Internal Commands

The IF Command

Description:

Performs conditional processing in batch programs.

Command Syntax:

IF [NOT] ERRORLEVEL number command
IF [NOT] string1==string2 command
IF [NOT] EXIST filename command

Explanation of Syntax:

[NOT] specifies that MS-DOS should carry out the command only if the condition is false.
ERRORLEVEL number Specifies a true condition if the last program run returned an exit code equal to or greater than the number specified.
command specifies the command to carry out if the condition is met.
string1==string2 specifies a true condition if the specified text strings match.
EXIST filename specifies a true condition if the specified filename exists.

Command Use:

This command can only be used in batch files.