Software Question

Checking systems environment variables in a Basic MSI Project.

02/05/2015 1459 views
Hi Guys,

Please let me how to implement the below configuration in a MSI package
At the beginning of installation, I want to check a certain environment variable. e.g. "%MYPATH". If this variable is not found, the installation should abort. If the variable is found, the value should be written to INSTALLDIR property and the installation should proceed to that directory.
0 Comments   [ + ] Show comments


All Answers

The "locator" tables do not include any functionality to search for environment variables, so I would suggest writing a custom action that reads the environment variables and looks for the specific variable you need to find. If found, the variable is then loaded into a property value that is returned to the MSI and used as a launch condition.  The alternative to reading the environment variables directly is to look for the specific environment variable within the registry - if I recall correctly the system environment variables will be under: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\<name of environment variable>
Answered 02/05/2015 by: EdT
Red Belt

  • ...so the OP could use the RegLocator table :-)
    • >sigh< Just slapping myself with a wet kipper for once again missing the obvious.....

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ