Welcome to MSDN Blogs Sign in | Join | Help

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 http://www.microsoft.com/info/cpyright.htm.
Published Friday, September 16, 2005 7:00 AM by Windows Installer Team
Filed under:

Comments

# re: How do I read an environment variable into the MSI?

Friday, September 16, 2005 12:06 PM by Vivek
I have been trying to write an environment variable from a setup and deployment project. I realized it was not possible, or was too difficult, and ended up creating a custom action that in turn calls a managed dll. This dll does the job of changing the environment variable (in my case PATH)

# Copyright Revewals » Windows Installer Team Blog : How do I read an environment variable …

New Comments to this post are disabled
 
Page view tracker