MAKEMSI quickly and reliably creates MSI files in a non-programmatic way
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
[Bottom][Contents][Prev]: /DllCaEntry[Next]: EventLogCustomView
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->Environment

The "Environment" Command

This command creates or updates environment variables. To do this it populates the MSI "Environment" table.

You should use the Path command to manipulate "path like" environment variables.

The macro takes these parameters:

User Logoff or Reboot Required?

To pick up the changed environment variables the user may need to logoff and logon (user environment variables) or reboot (system environment variables). This is because the variables are per-process and will not normally change until the process is restarted at which time it typically inherits the parent processes environment.

Windows Installer will broadcast the "WM_SETTINGCHANGE" message (lParam set to the string "Environment") to all top level windows so that these processes have the opportunity to update their per-process environment details if they so wish. It is a known Windows "feature" that the SCM (services) doesn't handle this message.

As a diagnostic aid, the "PROCESS EXPLORER" tool can show you the "process hierarchy" as well as each processes environment.

EXAMPLES

<$Component "Environment" Directory_="<$AnyDir>" LM="Y">
   ;--- Test environment macro (create in install, remove in uninstall) -----
   <$Environment Name="EnvVarLit"  VALUE="Value4EnvVar1">                ;;Assign literal
   <$Environment Name="EnvVarExp" *VALUE="WeekDayName(WeekDay(date()))"> ;;Assign result of VBSCRIPT expression
<$/Component>
<$Component "SomeExistingComponentJustAsAnExampleOfHowToDoIt">
   ;--- Test PATH macro -----------------------------------------------------
   <$Path   "C:\Some\Path">                  ;;Normally update "PATH"
   <$Path   "[TARGETDIR]">                   ;;Refer to MSI directory/property
   <$Path   ".REX"          NAME="PATHEXT">  ;;Update another type of "path like" environment
<$/Component>


Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.Please email me any feedback, additional information or corrections.
See this page online (look for updates)

[Top][Contents][Prev]: /DllCaEntry[Next]: EventLogCustomView


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Saturday May 28 2022 at 3:11pm
Visit MAKEMSI's Home Page
Microsoft awarded me an MVP (Most Valuable Professional award) in 2004, 2005, 2006, 2007, 2008 & 2009 for the Windows SDK (Windows Installer) area.