Click here to return to the KiXtart HelpDesk main page...

KiXtart Command Reference

IF ELSE ENDIF

action

Conditionally runs statements.

syntax

IF expression
statement1
      ....
[ELSE
      statement2
       ....       ]
ENDIF

remarks

The body of an IF statement is executed selectively depending on the value of the expression. If expression is true, then statement1 is executed. If expression is false and the ELSE clause is specified, then statement2 is executed.

IF statements can be nested as many times as memory allows.

If the expression does not contain any relational operators, the condition is considered to be true if it is numeric and it evaluates to a value other than zero, or if it is alphanumeric and it evaluates to a string containing at least one character.

Comparisons are not case-sensitive.

examples

IF $X                ; similar to IF $X <> 0

IF @HOMESHR              ; similar to IF @HOMESHR <> ""

IF INGROUP("Domain Admins")       ; similar to IF INGROUP("Domain Admins") > 0

IF INGROUP("Domain Admins") = 0   ; true if user NOT a Domain Admin

IF $X*2 < 10

IF (($X*2) < 10) OR ($Y + 100) /3 >120

IF INSTR(%PATH%,"NETLOGON") AND @DOS = "3.51"

IF (SUBSTR(@WKSTA,11,1)="1" AND @USERID = "PETERV") OR  @DOMAIN = "VleerBeer"

IF @USERID = "RUUDV" OR @USERID = "WIMW"

IF (INGROUP("Domain Users") OR INGROUP("Users"))