Conditional expressions

InstallMate allows the use of conditional expressions in many places. The conditional expression syntax is defined as follows; this also defines (implicitly) the order of precedence of the various constructs. You can override the order of precedence by enclosing a term in parentheses.

condition ::= imp-term
imp-term  ::= eqv-term | eqv-term IMP imp-term
eqv-term  ::= xor-term | xor-term EQV eqv-term
xor-term  ::= or-term | or-term XOR xor-term
or-term   ::= and-term | and-term OR or-term
and-term  ::= not-term | not-term AND and-term
not-term  ::= term | NOT term
term      ::= value | value relop value | ( imp-term )
value     ::= symbol | literal | version | integer
relop     ::= < | <= | > | >= | = | <> | >< | << | >> | ~relop
symbol    ::= varname | varref | %envvar | $compname | ?compname | &compname | !compname
literal   ::= "...any text..."
integer   ::= ...sequence of decimal digits... | 0x...sequence of hexadecimal digits...
varname   ::= ...name of a symbolic variable (case-insensitive)...
varref    ::= ...symbolic expression enclosed in < and > (case-insensitive)...
envvar    ::= ...environment variable name (case-insensitive)...
compname  ::= ...component name (case-insensitive)...

Symbolic expressions

InstallMate allows the use of all symbolic expressions as part of conditional expressions. You can therefore also perform registry and INI file lookup (<@reg_path> and <#file?section?value>), retrieve file paths (<#file_alias>), and execute symbolic functions such as $fverpcmp as part of conditional expressions. It also means that the following are equivalent for InstallMate:

Note: To prevent confusion between symbolic expressions and some of the relational operators, you should place spaces on either side of a relational operator. For example, use TsuStatus < 0 rather than TsuStatus<0.

Logical operators

The following logical operators are defined. Their names are case-insensitive.

Operator Meaning
NOT Negates the value of its operand.
AND True if both operands are True.
OR True if at least one of its operands is True.
XOR True if exactly one of its operands is True.
EQV True if its operands are both True or both False.
IMP True if its left operand is False or its right operand is True.

Relational operators (relop)

The following relational operators are defined. Their meaning depends on the type of their operands:

Note: The conditional expression parser performs a deep scan of the relational operator's operands. This means, for example, that both TsuRunMode > 0 and TsuRunMode > "0" are evaluated with an integer comparison, while LogonUser = "Administrator" uses a string comparison (assuming that <LogonUser> contains a name and not a number or version).

Tip: To force a relational operator to use a string comparison even if one or both operands are numeric or a version number, use the ~ prefix (see table below). For example, TsuRunMode ~> 0 will do a string comparison instead of an integer comparison.

Operator Version Integer String
< True if the left operand is a lower version number than the right operand. True if the left operand is numerically less than the right operand. True if the left operand sorts before the right operand.
<= True if the left operand is a lower than or equal version number as the right operand. True if the left operand is numerically less than or equal to the right operand. True if the left operand sorts before or is equal to the right operand.
> True if the left operand is a higher version number than the right operand. True if the left operand is numerically greater than the right operand. True if the left operand sorts after the right operand.
>= True if the left operand is a higher than or equal version number as the right operand. True if the left operand is numerically greater than or equal to the right operand. True if the left operand sorts after or is equal to the right operand.
= True if the left operand is the same version number as the right operand. True if the left operand is equal to the right operand. True if the left operand is equal to the right operand.
<> True if the left operand is a different version number than the right operand. True if the left operand is not equal to the right operand. True if the left operand is not equal to the right operand.
>< Not supported. True if the left and right operands have any bits in common (binary AND). True if the left operand contains the right operand.
<< Not supported. True if the 16 most significant bits of the (32-bit) left operand are equal to the right operand (HIWORD). True if the left operand starts with the right operand.
>> Not supported. True if the 16 least significant bits of the left operand are equal to the right operand (LOWORD). True if the left operand ends with the right operand.
~ (as prefix) Force case-insensitive string comparison. Force case-insensitive string comparison. Makes the comparison case-insensitive.

Symbol prefixes

The following prefixes can be used on symbol items.

Symbol prefix Operand Result
% Name of environment variable Value of the environment variable
$ or & Name of component Component action (see below)
? or ! Name of component Component state (see below)

Notes:

Component action and state values

The following values are returned for the component actions and states:

Value Action State
-1 No action State is unknown
1 (reserved) (reserved)
2 Component will be removed Component is not present
3 Component will be installed locally Component is installed locally
4 (reserved) (reserved)

Examples

Here are some examples of conditional expressions:

VersionNT64
Evaluates to True if the installer is running on a 64-bit Windows version. The VersionNT64 variable is a predefined variable that is set to a nonzero value if the installer is running on a 64-bit Windows version.
<VersionNT64>
Same as the previous expression. The < and > angle brackets are optional when referring to a variable in a conditional expression.
NOT VersionNT64
Evaluates to True if the installer is not running on a 64-bit Windows version, for example on a 32-bit Windows NT variant (NT4, 2000, XP, 2003, Vista, 7, 2008, etc) or a 32-bit Windows 9x variant (95, 98, Me).
VersionNT64 AND Intel64
Evaluates to True if the installer is running on a 64-bit Windows version with an IA-64 architecture processor. The VersionNT64 variable is a predefined variable that is set to a nonzero value if the installer is running on a 64-bit Windows version; Intel64 is set on systems with an Intel IA-64 architecture processor.
VersionNT64 AND NOT Intel64
Evaluates to True if the installer is running on a 64-bit Windows version with a processor other than an IA-64 architecture processor (for example, an AMD-64 or EM64T processor). The VersionNT64 variable is a predefined variable that is set to a nonzero value if the installer is running on a 64-bit Windows version; Intel64 is set on systems with an Intel IA-64 architecture processor.
VersionNT64 AND Msix64
Evaluates to True if the installer is running on a 64-bit Windows version with an AMD-64 or EM64T architecture processor. The VersionNT64 variable is a predefined variable that is set to a nonzero value if the installer is running on a 64-bit Windows version; Msix64 is set on systems with an AMD-64 or EM64T architecture processor.
%NUMBER_OF_PROCESSORS > 1
Evaluates to True if the installer is running on a system with more than one processor core, as determined by the environment variable NUMBER_OF_PROCESSORS. The > character is the "greater than" operator and should have at least one space on either side.
<%NUMBER_OF_PROCESSORS> > 1
Same as the previous expression. The < and > angle brackets are optional when performing an environment variable lookup in a conditional expression.
<@<HKLM>\Software\Microsoft\Windows NT\CurrentVersion\InstallationType> = "Client"
Evaluates to True if the installer is running on a Windows NT variant (NT4, 2000, XP, 2003, Vista, 7, 2008, etc.) that was installed as a Client system. The < and > angle brackets are required here to perform the registry variable lookup. The "quotes" in the "Client" string are required to prevent interpretation of Client as a (non-existing) symbol name .
<@<HKLM>\Software\Microsoft\Windows NT\CurrentVersion\InstallationType> ~= "Client"
Same as the previous expression, except that the string comparison is performed case-insensitive. This condition therefore also evaluates to True if the registry contains CLIENT, client, or any other upper/lowercase mixture.
$SomeComponent = 3
&SomeComponent = 3
Evaluates to True if the component SomeComponent will be installed during the session. Either the $ or the & prefix may be used; this is a holdover from previous versions of InstallMate.
$SomeComponent = 2
&SomeComponent = 2
Evaluates to True if the component SomeComponent will be removed during the session. Either the $ or the & prefix may be used; this is a holdover from previous versions of InstallMate.