How do I read an environment variable into the MSI?

Question

How do I read an environment variable into the MSI?

Answer

Check out the MSDN topic Restrictions on Property Names [Windows Installer] which says

Property names prefixed with % represent system and user environment variables.

Check out the MSDN topic Formatted [Windows Installer] which says

If a substring of the form [%environmentvariable] is found, the value of the environment variable is substituted for the substring.

Property names prefixed with % represent system and user environment variables.

Content credit also belongs to

  • Rob, Microsoft Dev and WiX Project Lead. You can get other Rob insights about developing for Windows Installer from his blog when setup isn't just xcopy

[Author: Robert Flaming]

This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at https://www.microsoft.com/info/cpyright.htm.