mmadden
Posts: 22
Joined: Fri Jun 10, 2005 6:21 pm
Location: West Conshohocken, PA

Environment Variable not avail to Batch file via Installer

Using custom Dialogs, I set various Registry settings and Environment variables.

One of the last steps in my install is to execute a batch file.
My batch file uses these environment variables to take certain actions depending on the choices made in the dialogs.
But the variables don't exist for my batch file when the installer executes.

I verified that the registry and environment variables are indeed getting set. As a matter of fact, if I manually execute the batch file after the installer is done, it works fine. I can see the Variables using the set command at the command prompt. I can also see the variables set properly in the Environment Variables GUI for Windows.

I was curious to see if maybe the variables weren't getting applied until after the installer completed, but doesn't seem to be the case. I placed a pause at the end of my batch file, which essentialy pauses the installer from completing. The installer window indicates a status of ' Removing backup files' until the Batch file completes. I have the Batch file set to execute in the Commit section. While still paused, if I manually look at the environment variables (set or gui) they are present and correctly set. As a matter of fact if I launch a second copy of the batch file in a separate CMD window, it runs fine and using the environmnet variables. But they are not available to the batch that is launched from within the installer.

I tried setting the variables from user to system type but with no change.

Help. I don't want to have to resort to reading registry values from within the batch file just to acomplish my goals.

Thanks
gigi
Posts: 2103
Joined: Tue Apr 11, 2006 9:55 am
Contact: Website

Hi,

Environment variables that are set during installation are available only after installation. You can read more about this here:
http://msdn2.microsoft.com/en-us/library/aa372883.aspx

Regards,
Gigi
Gheorghe Rada
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”