Conditional Statement Syntax

InstallShield 2019

Project • This information applies to the following project types:

Basic MSI
DIM
InstallScript MSI
Merge Module
MSI Database
MSM Database
QuickPatch
Transform

Conditional statements have a strictly governed syntax that uses properties, Windows Installer table keys, literals, and evaluative operators.

Functionality

A conditional statement performs some action in an installation—such as launching a custom action or installing a component—based on whether the expression evaluates to True, which has the numeric value of 1. False returns have the numeric value of 0. The simplest of expressions, specifying a property name, is True if the property is defined. For example, the simple conditional statement Version9X evaluates to True when the installation is running under Windows 95 or Windows 98.

You can build more complex conditional statements using the operators and values described in the tables below.

Values

The following table describes how to use values in your conditional statements. All values except for environment variables are case sensitive.

Descriptions of Values

Value

Description

Windows Installer property

The name of the property. Nonexistent properties are evaluated as empty strings.

Integer

Any integer value from -32,767 to +32,767. You cannot use a floating point value.

String literal

Enclose the text in quotation marks. For example:

"InstallShield"

Environment variable

Precede the variable name with a percent symbol. For example:

%TEMP

Operators

The tables below list all of the conditional statement operators by type. Note the following:

The operators follow the same precedence as those in Visual Basic.
Use parentheses to override precedence.
Operators are not case sensitive.
Unlike in Visual Basic, there are no arithmetic operators.
Precede the operator with a tilde (~) if you do not want the comparison to be case sensitive.
The result is always False when you compare a string with an integer, unless you use the <> operator.

 

Descriptions of Logical Operators

Logical Operator

Description

Not

Performs logical negation. The result is True if the value is False, and vice versa.

And

The result is True if both values are True.

Or

The result is True if either value is True.

Xor

The result is True if only one of the values is True.

Eqv

The result is True if both values are True or both values are False.

Imp

Performs a logical implication. The result is True if the first term is False or the second is True.

 

Descriptions of Comparative Operators

Comparative Operator

Description

=

The result is True if the first value is equal to the second.

<>

The result is True if the first value is not equal to the second.

>

The result is True if the first value is greater than the second.

>=

The result is True if the first value is greater than or equal to the second.

<

The result is True if the first value is less than the second.

<=

The result is True if the first value is less than or equal to the second.

 

Descriptions of Substring Operators

Substring Operator

Description

><

The result is True if the first string contains the second.

<<

The result is True if the first string starts with the second.

>>

The result is True if the first string ends with the second.

 

Descriptions of Bitwise Operators

Bitwise Operator

Description

><

The result is True if both integers have any bits in common.

<<

The result is True if the high 16 bits of the first integer are equal to the second integer.

>>

The result is True if the low 16 bits of the first integer are equal to the second integer.

See Also