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]: MsiValFilter[Next]: Platform
Have your say! Join the MAKEMSI discussion list or view archive! Suggest improvements. No question too simple or too complex.
\->Source Code->Commands->Path

The "Path" Command

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

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>

WARNING

Have a look at the following bugs:

  1. PATH Completely Cleared!
  2. PATH Update Flakey in WIN95/98

Note that the value will end with a slash, if this causes problems with your program then I'd suggest you fix your program, however if its someone else's then see the "Trailing Slash Removal" section for an example that uses a custom action or perhaps a better way is to use "." (for "current" directory), for example:

<$Path "[INSTALLDIR]." System="N">


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]: MsiValFilter[Next]: Platform


MAKEMSI© is (C)opyright Dennis Bareis 2003-2008 (All rights reserved).
Sunday February 28 2016 at 3:45pm
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.