Examples of Conditional Statement Syntax

Windows Installer

Examples of Conditional Statement Syntax

The following provides some common instances of conditional statements. For more information, see Conditional Statement Syntax.

Run action on removal.

For information, see Conditioning Actions to Run During Removal.

Run action only if the product has not been installed.

NOT Installed

Run action only if the product will be installed local. Do not run action on a reinstallation.

(&FeatureName=3) AND NOT(!FeatureName=3)

The term "&FeatureName=3" means the action is to install the feature local. The term "NOT(!FeatureName=3)" means the feature is not installed local.

Run action only if the feature will be uninstalled.

(&FeatureName=2) AND (!FeatureName=3)

This condition only checks for a transition of the feature from an installed state of local to the absent state.

Run action only if the component was installed local, but is transitioning out of state.

(?ComponentName=3) AND ($ComponentName=2 OR $ComponentName=4)

The term "?ComponetName=3" means the component is installed local. The term "$ComponentName=2" means that the action state on the component is Absent. The term "$ComponentName=4" means that the action state on the component is run from source. Note that an action state of advertise is not valid for a component.

Run action only on the reinstallation of a component.

?ComponentName=$ComponentName

Run action only when a particular patch is applied.

PATCH AND PATCH >< MEDIASRCPROPNAME

For more information, see the Remarks section on the PATCH property page.

Send comments about this topic to Microsoft

Build date: 8/13/2009

© 2009 Microsoft Corporation. All rights reserved.