Share via


Using a Registry Launch Condition to Specify a Target Directory

A Registry launch condition can be used to search for a required registry key or value and display an error message if it is not found.

In addition to searching for the existence of a registry key or value, a registry search can be used to retrieve a value from the registry; that value can then be used to set a property in an installer during installation. For example, you might want to install a file in the same directory as Internet Explorer. There is no guarantee that Internet Explorer is installed in the same location on every computer; however, there is a registry key that specifies where it is located.

If the registry search fails to find a match (for example, if Internet Explorer is not installed), installation will fail. The launch condition evaluates the value returned by the registry search; if it is blank, then an error message is displayed.

The following example uses a registry search to determine the target directory for a file.

To install a file based on a registry search

  1. On the View menu, choose Editor, Launch Conditions.

  2. Select the Requirements on Target Machine node.

  3. On the Action menu, choose Add Registry Launch Condition.

  4. Select the Search for RegistryEntry node. In the Properties window, select the Root property and select the registry root to be searched.

    For example, to search for Internet Explorer, choose vsdrrHKLM, which will search the HKEY_LOCAL_MACHINE root.

  5. Select the RegKey property and type the name of the registry key to search for.

    For example, to search for Internet Explorer, type SOFTWARE\Microsoft\IE Setup\Setup.

  6. Select the Value property and type the registry value to search for.

    For example, to search for Internet Explorer, type Path.

  7. Select the Property property and type a meaningful name for the property.

    For example, for the Internet Explorer search, type SearchForIE.

  8. Select the Condition node. In the Properties window, select the Condition property and type the name of the condition to evaluate. This should match the Property property entered for the registry search.

    For example, for the Internet Explorer launch condition, type SearchForIE.

  9. Select the Message property and type the error message that will be displayed if the registry value is not found.

    For example, for the Internet Explorer launch condition, type Internet Explorer is required for installation.

  10. On the View menu, choose Editor, File System.

  11. In the File System Editor, select the File System on Target Machine node.

  12. On the Action menu, choose Add Special Folder, Custom Folder.

  13. In the Properties window, select the DefaultLocation property and type the property that specifies the location.

    For example, for the Internet Explorer launch condition, type [SearchForIE] (the value of the Property property for the registry search).

    Note   When referencing a property in any property other than the Condition property, the square brackets are required.

    When the installer is run, the value of the Property property will be evaluated and placed in the DefaultLocation property; the files will be installed in the location specified by that value.

See Also

Property Property | Launch Condition Management in Deployment | File Installation Management in Deployment