Command Line

 


Use keywords to find the content you
are looking for with in the site.

Command IF

Function:

Perform conditional processing in a batch program.
Syntax:
IF [NOT] condition command

or

IF [NOT] condition ( command(s) ) else command

or

IF [NOT] condition { command(s) } else command

conditionIs one of the following :-

( expr )Evaluate the parameter expr. A zero result is false, otherwise the condition is true. Parameter expr follows the same rules as parameter expr for command CALC. The brackets around parameter expr are mandatory and must be specified.
ERRORLEVEL numberSpecifies a true condition if the last program returned an exit code greater than or equal to number.
EXIST filenameSpecifies a true condition if the filename exists.
EXISTCLASS "text"Specifies a true condition if the window class "text" exists.
EXISTWINDOW "text"Specifies a true condition if the window caption "text" exists.
string1==string2Specifies a true condition if string1 and string2 are the same.

commandSpecifies the command to carry out if the condition is met. Parameter command can also be another IF command.
NOTCarry out the command only if the condition is false.
Note:
  • The parameters string1 and string2 do not need to be enclosed in quote characters.
  • When using the IF ELSE syntax, the brackets or braces around parameter command(s) are mandatory and must be specified. See Command Grouping for more information.
  • Examples on using IF.
  • Also see command CALC and Batch Programs.

Copyright © 1995-2018 Lucien Cinc, All Rights Reserved
WinOne® is an Australian registered trademark

Go to the Australian Command Line Software web site.