Yugo45
Posts: 6
Joined: Mon Oct 03, 2005 7:54 pm

When are environment variables set?

I have 4 env. vars set during the installation. However, several batch files that I run during the installation depend on the values in those vars.

When are the env vars set in the installation process?

If I move my batch file calls from "Install" section of InstallExecuteSequence to Commit, is that going to ensure all the vars are set before batch files run?

Thanks.
ciprian
Posts: 259
Joined: Thu Jul 14, 2005 12:56 pm
Location: Craiova, Romania
Contact: Website

Hi,

I'm afraid that the system is notified of the change of the environment variables after the installation process is completed.

So it doesn't matter where you place those custom actions because the environment variables will not be found.

For more information on this topic please visit:
http://msdn.microsoft.com/library/defau ... action.asp

All the best,
Ciprian
Ciprian Burca
Advanced Installer Team
http://www.advancedinstaller.com
Yugo45
Posts: 6
Joined: Mon Oct 03, 2005 7:54 pm

That's interesting, since I did place the custom actions into commit section of the installation sequence and they seem to be working properly (aka. the vars are set by then).

Are you saying that this could be an unreliable behavior and I should not count on the vars to be set in commit phase?
ciprian
Posts: 259
Joined: Thu Jul 14, 2005 12:56 pm
Location: Craiova, Romania
Contact: Website

Hi,

Microsoft's Platform SDK states:

"Environment variables do not change for the installation in progress when either the WriteEnvironmentStrings action or RemoveEnvironmentStrings action are run. On Windows NT and Windows 2000, this information is stored in the registry and a message is sent to notify the system of changes when the installation completes....On Windows 95, Windows 98, and Windows Me this information is stored in the Autoexec.bat file, and do not affect the system until a system restart."

It also states:
"A new process, or another process that checks for these messages, uses the new environment variables."

I think this is the case and might not be an unreliable behavior.
Also I have conducted some tests it resulted that under the "Commit" standard action the environment variables are set.

All the best,
Ciprian
Ciprian Burca
Advanced Installer Team
http://www.advancedinstaller.com

Return to “Common Problems”