Using Environment Variables in Registry Values

InstallShield 2020

Project:This information applies to the following project types:

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

With REG_EXPAND_SZ string values, you can use environment variables for paths that are stored in the registry. These entries require special formatting in order to be recognized by the operating system as environment variables. The format for a REG_EXPAND_SZ value as it appears in the registry is %TEMP%. TEMP is the standard environment variable for the TEMP directory.

Syntax

When creating registry entries of this type, you need to begin the entry with a pound sign followed by a percent sign (#%). Then, you can enter your environment variable, complete with the beginning and ending percent sign. Therefore, if you enter #%%TEMP% in the Registry view in InstallShield, it appears as %TEMP% when written to the registry.

The Type field for this entry appears as REG_EXPAND_SZ, and the Data field is %TEMP%.

See Also