Application PATH and Environment Variables
Previous  Top  Next


SetupCapture will automatically capture system and user Environment Variables changes that occur indirectly by capturing and comparing the registry. If an application needs a specific environment variable in order to run correctly, you can make environment variable changes prior to completing the setup capture process. Typically the application's installer should do this automatically.

To manually add environment variables to Thinstall packages during the Setup Capture process, use My Computer -> Properties -> Advanced -> Environment Variables
You can add new variables to either System or User.

clip0023

Windows stores environment variables on a system-wide and user-specific basis. The location for these two stores are located in the following locations.

System-wide environment variables:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

User-specific environment variables:
HKEY_CURRENT_USER\Environment

For packages running under Thinstall, any environment variables captured in these 2 locations will be applied for all applications running in the same Sandbox. Per-user values take precendence over per-machine values. You can manually edit HKEY_LOCAL_MACHINE.txt and HKEY_CURRENT_USER.txt to add environment variables after the capture has completed. For example, the following text can be appended to the end of HKEY_LOCAL_MACHINE.txt to add a CLASSPATH environment variable which contains the string "c:\mypath"

isolation_writecopy HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
Value=CLASSPATH
REG_SZ~c:\mypath#00

Note: the "Path" variable is ignored by Thinstall, instead a new variable "VirtualPath" is used (see below).

The PATH variable

The PATH environment variable is treated differently because typically you do not want to completely replace the local system PATH variable, but instead prepend specific values. To accomplish this, SetupCapture uses a special value called "VirtualPath" to store the portions of the PATH variable that changed during setup capture. This VirtualPath will be prepended to the local system PATH during program execution.