Path Variables View

InstallShield 2013

Project: The Path Variables view is available in the following project types:

Advanced UI
Basic MSI
DIM
InstallScript
InstallScript MSI
InstallScript Object
Merge Module
Suite/Advanced UI

The traditional way to link to source files in an installation project is to create a reference to that file using a hard-coded path. For example, you might have a source file called Program.exe located at C:\Work\Files that you want to include in your installation.

Using Hard-Coded Paths

If you use hard-coded paths, you have to enter the entire path every time you want to associate a source file from that directory. If you move the file to another directory, you have to change the hard-coded path as it appears in your installation project. If your installation consisted of a small number of source files, this might not be a problem. Unfortunately, some installations contain thousands of files that all need to be remapped if you change the folder structure or migrate the project to a different machine.

Using Path Variables

With path variables, you can define commonly used paths in a central location so that you do not need to change every source file’s path each time you move the project or change the directory structure. In the previous example, if you keep all of your application’s source files in various subfolders under C:\Work\Files, you could create one variable that points to the Files folder—<MyFiles>. If you want to include a file that is in C:\Work\Files\Images, you enter <MyFiles>\Images. If you move your files to D:\Work\Files, you can go to one place, your variable <MyFiles>, and change the folder that it points to.

All path variables can be viewed and modified in the Path Variables view. You can use path variables in almost any location in InstallShield where you link to source files, such as in the Dialog Editor, dynamic file links, and the release location. Instead of entering the path variables yourself, you can have InstallShield recommend them whenever you browse to a path.

Note: Path variables are used during the development of your installation project. These paths do not apply to the target machines where the application is being installed. Rather, they are used to link to source files for your installation project. When the project is built, those links are evaluated and the files they point to will be built into the installation.

Path Variables Types

There are four types of path variables that you can use. Each type functions somewhat differently from the others. Regardless of the path variable type you use, the variable name is provided in the same manner throughout InstallShield.

Types of Path Variables

Variable Type

Description

Predefined path variables are path variables that point to some of the most commonly used folders. Unlike other types of path variables, these values cannot be edited in InstallShield. For more information, see Predefined Path Variables.

The values of registry-based path variables are derived from the registry keys you created. After creating the registry key, you need to set a path variable to this key. For more information, see Registry Path Variables.

Environment path variables are based on the values of your system’s environment variables. You can set an environment path variable to an existing environment variable. For more information, see Environment Variables.

Standard, or user-defined, path variables are defined through InstallShield. You can specify a path variable such as <MyFiles> with a value of C:\Work\Files. These variables do not rely on any outside sources, such as the registry or system paths. For more information, see Standard Path Variables.

You also have the option of converting existing static links to path variables with the Convert Source Paths Wizard. This wizard scans your installation project for static links and changes those links to path variables, which makes your project more easily portable.

Working with the Path Variables View

The Path Variables view consists of the following elements:

A row of buttons and other controls
A group box area (below the row of buttons)
A list of path variables that are defined in your project

The following table describes all of the buttons and other controls that are displayed in the Path Variables view.

Controls in the Path Variables View

Name of Control

Icon

Description

New Path Variable

Adds a new standard path variable to your project.

To create a registry path variable or an environment variable, you can click the arrow next to this button, and then click the appropriate command. To learn more, see Creating and Defining a Path Variable.

Delete Selected Path Variables

Deletes the selected variable or variables.

Refresh

Refreshes the list of variables in the view.

Expand All Groups

Shows all of the rows in the groups if you are using groups to organize the rows in a hierarchical format.

Collapse All Groups

Hides all of the rows in the groups if you are using groups to organize the rows in a hierarchical format.

Show Group Box

Shows or hides the group box area below the row of buttons in this view.

Search Grid

 

Dynamically filters the path variables that are displayed in the Path Variables view according to the string that you specify in this search box. As you type a string in this box, InstallShield hides all of the rows that do not contain it.

Path Variables View Help

Displays the help for the Path Variables view.

Drag a column header here to group that column

 

Use this group box area to group rows in the view. The view supports multiple levels of grouping simply by dragging the column headings and dropping them onto the group box. InstallShield displays the rows in the view hierarchically according to column arrangement in the group box.

To learn more, see Working with the Group Box Area in Various Views.

The following table describes each of the columns in the Path Variables view.

Columns in the Path Variables View

Column

Description

Name

In this column, enter the name of your variable. You do not need to enter angle brackets, but the path variable is displayed in angle brackets whenever it is used in a path.

For example, if your variable is named MyRegVar and a component’s files are linked to the folder contained in its value, the component’s Link To folder shows <MyRegVar>.

Defined Value

In this column, define the value of the path variable.

For Standard Path Variables

For standard variables, enter the directory to which you would like your variable to point.

Note: You can also refer to other path variables in the defined value by enclosing the referenced path variable name in angled brackets. For example, if you have a path variable called MyRoot with a value of C:\, you can refer to it in a path variable definition for another variable, such as Games. The actual path for the Games variable might be C:\Programs\GameFiles, but you can define Games as <MyRoot>\Programs\GameFiles. However, if you attempt to self-reference a path variable, the literal string is used instead. For example, defining Games as <MyRoot>\Programs\<Games> actually results in Games defined as C:\Programs\<Games>.

For Registry Path Variables

Enter the complete registry key, with the final “subkey” being the name of the value whose data contains the folder. For example, define MyRegVar as follows:

HKEY_LOCAL_MACHINE\SOFTWARE\TestKey\TestValue

Assume that TestKey has the following subkey and values:

[HKEY_LOCAL_MACHINE\SOFTWARE\TestKey]

@="C:\\MyPath1"

"TestValue"="C:\\MyPath2"

[HKEY_LOCAL_MACHINE\Software\TestKey\TestValue]

@="C:\\MyPath3"

Even though HKEY_LOCAL_MACHINE\SOFTWARE\TestKey has a subkey called TestValue, MyRegVar points to the value TestValue, and the current value will be C:\MyPath2. (Note, however, that if a value named TestValue does not exist, InstallShield reads the default value (C:\MyPath3) of the subkey HKEY_LOCAL_MACHINE\SOFTWARE\TestKey\TestValue.)

For Environment Path Variables

For environment path variables, enter the name of the variable as it appears on the Environment dialog box.

Current Value

This is a read-only column that contains the actual path that the variable points to. This is a useful reference for environment and registry path variables, since they are defined outside InstallShield.

Test Value

Project: This column applies to the following project types:

Basic MSI
DIM
InstallScript MSI
Merge Module

This column enables you to enter a hard-coded path that can be used when the registry path variable is resolved. To use test values in your release, you must select the Use path variable test values option on the Advanced Settings panel of the Release Wizard. This option is deselected by default. When this option is selected, the test value is used for all registry path variables. Otherwise, the test value is not used at all.

Type

This column shows the type of variable (predefined, standard, environment, or registry).

Click a field in this column to change from one type of path variable to another. Note that you cannot change the type of a predefined path variable.

Tip: To override the value of a user-defined path variable, an environment variable, or a registry value for a particular release at build time, use the Path Variable Overrides setting on the Build tab for that release. To learn more, see Build Tab for a Release.

See Also