Re: Environment Variable Load Order




"F. David del Campo Hill" <FDaviddelCampoHill@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote in message news:D978AE86-EDFC-4471-B543-AD3BB03C32B5@xxxxxxxxxxxxxxxx
Dear All,

Does anyone know the order in which (system) environment variables are
loaded upon user log in?

I have an installation program which sets one system environment variable:

GTK_BASEPATH=C:\GTK

and changes the path system environment variable adding:

PATH=%GTK_BASEPATH%\bin;...

This works as expected just after the installation (PATH is effectively
C:\GTK\bin;...), but if you log out and log in again (as any user) you
find
that %GTK_BASEPATH%\bin has NOT been "resolved" and files in that folder
are
not part of the PATH. If you reload the environment variables manually
(right-click My Computer > Properties > Advanced > Environment Variables >
...; no need to actually make any changes, just press OK), then the PATH
includes C:\GTK\bin again (%GTK_BASEPATH% is being "resolved" to its value
when calling PATH).

My assumption is that environment variables are loaded in a certain order
when a user logs in, and PATH is being loaded before GTK_BASEPATH, so it
is
ignoring the %GTK_BASEPATH%\bin at its beginning. But it is only an
assumption, so can anyone provide information on the order or priority of
environment variables?

Thank you for your help.

F. David del Campo Hill

I suspect that there is no published rule that says in which order
such variables are resolved. To make your installation robust, you
should hard-code this variable into the %path%. This is, in fact,
what the installation program should have don. After all, the value
of this variable was fully known to the installation program, hence
there is no justification to soft-code it into the %path%!

While you're at it you might as well tack it to the ***end*** of
the path. The most often used folders (c:\windows\system32 and
c:\windows) should be located at the beginning of the %path%,
for obvious reasons.


.



Relevant Pages

  • Re: Environment Variable Load Order
    ... Does anyone know the order in which environment variables are ... loaded upon user log in? ... I have an installation program which sets one system environment variable: ...
    (microsoft.public.windowsxp.general)
  • Environment Variable Load Order
    ... Does anyone know the order in which environment variables are ... loaded upon user log in? ... I have an installation program which sets one system environment variable: ... If you reload the environment variables manually ...
    (microsoft.public.windowsxp.general)
  • Re: Environmental Variable
    ... It is not at all required to set / create any environment variables before ... SQL Server installation. ... installation program will do all the necessary path entries automatically. ...
    (microsoft.public.sqlserver.connect)
  • Re: Word 2007 on term session - "Word could not create the work fi
    ... that the Temporary Internet Files folder is stored in C:\WINDOWS. ... MCSE, CCEA, Microsoft MVP - Terminal Server ... User environment variables match on both ... you might have to update/add the shadow key in the ...
    (microsoft.public.windows.terminal_services)
  • Re: Word 2007 on term session - "Word could not create the work fi
    ... When I temporarily enabled full control for Users on this folder, ... MCSE, CCEA, Microsoft MVP - Terminal Server ... I would have a hard look at the Data subkey in the registry. ... System environment variables: ...
    (microsoft.public.windows.terminal_services)