IF (Command Processor)

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

This command performs conditional processing in batch programs.

IF [NOT] ERRORLEVEL numbercommand
IF [NOT] string1==string2command
IF [NOT] EXIST file_namecommand
IF [NOT] DEFINED variablecommand

Parameters

  • NOT
    Specifies that Windows Embedded CE 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 file_name
    Specifies a true condition if the specified file name exists.
  • DEFINED variable
    Specifies a true condition if the specified environment variable is defined.

See Also

Reference

Command Processor Commands

Concepts

Command Processor Shell