if (Device Management Client) (Windows CE 5.0)
This command evaluates an expression and conditionally executes a set of script commands.
The ifboolean command does a Boolean comparison.
The ifdatetime command does a date comparison.
The ifnumber command does a numeric comparison.
The ifstring command does a case-sensitive string comparison. The contains
operator is used to see if a given string contains a particular substring, in a manner similar to the C language strstr function.
The ifversion command does a comparison between two version strings.
if boolean [boolean string] [ == | != ] [boolean string]
if datetime [datetime string] [ == | != | < | <= | > | >=] [datetime string]
if number [numeric string] [ == | != | < | <= | > | >=] [numeric string]
if string [string][ == | != | < | <= | > | >= | contains] [string]
if version [version string] [ == | != | < | <= | > | >=] [version string]
Parameters
boolean string
The Boolean strings can be either TRUE, ON, YES, or 1 to represent a logical 1 or they can be either FALSE, OFF, NO, or 0 to represent a logical 0.datetime string
The datetime string represents a particular date and time and is specified as<4 digit year>-<month number>-<month day> <hours>:<minutes>:<seconds>
. The right-hand side datetime string can also be one of the following special keywords:yesterday lastmonth today thismonth tomorrow nextmonth lastweek lastyear thisweek thisyear nextweek nextyear These keywords can be used instead of specific dates to make scripts operative on relative time values.
numeric string
Each of the two numeric string specifies the numbers you want to do a numeric comparison on.string
Each of the two string specifies the strings you want to do a case-sensitive string comparison on.version string
Each of the two version string specifies the versions you want to do a version comparison on.
Remarks
You can specify multiple expressions to evaluate on a single command line using the OR operator between the expressions.
The following code example uses the if command to decide which message to output:
if string "%CCA_CURRENTLANGUAGE%" == "en-US"
echo "Hello World"
elseif string "%CCA_CURRENTLANGUAGE%" == "fr-CA"
echo "Bonjour le Monde"
else
echo "Hello"
endif
The following code example shows how to use the OR operator to specify multiple expressions on one command-line:
if string "%CCA_DEFAULTSTORE%" == dsk1: OR boolean "`pkginstalled MyPackage`" == TRUE
echo "Hello World"
endif
See Also
Send Feedback on this topic to the authors