Env Var Condition
Posted 10 June 2003 - 15:52
I try to install a component dependend on the value of an environment variable. The syntax used for this purpose may be the problem, because the condition allways evaluates TRUE:
Alternatively I tried to use a CA 51:
Execution Scheduling: Allways execute
Install UI Sequence: <First Action>
Install Exec Sequence: <First Action>
So can anyone tell me what went wrong?
Posted 11 June 2003 - 07:14
To be sure, I checked the value of TEST through the output of a MessageBox, after fetching the variable with GetEnvVar. This seemed to be fine, but the condition still evaluates to FALSE.
Placing the entire expression in double quotes
allways evaluates to TRUE. It seems, that every string evaluates to TRUE, regardless of it's content.
Do I need the CA 51? There's no difference even with or without it.
I also tried to use a property
but this was unsuccessfull too.
Thanks for your suggestions
Posted 11 June 2003 - 08:47
Further, the condition "~Test=XYZ" is indeed a text. Every non-empty text is considered True. You shouldn't need a CA51, just to copy the environment variable in a property. But for testing purposes, your CA is fine. Change the condition in
Are you sure that the environment variable is there? Try a well known variable, like PATH or TEMP.
Posted 11 June 2003 - 12:54
now I've made some progress with these environment vars. When using TEMP everything works well!
So it seems to me, that there's a difference between my temporary vars and system vars.
I used following command:
> set TEST=XYZ
and checked success with
> set TEST
Then I used GetEnvVar in the InstallScript function OnBegin() to read this variable and showed the value in a MessageBox. There's no evidence for an error - everything behaved as expected.
Does anyone know how to get arround this problem?
Posted 12 June 2003 - 06:57
Is it possible to get an error message from Windows Installer, if it encounters a problem with a condition or somthing else?
Posted 12 June 2003 - 08:16
Posted 16 June 2003 - 13:51
this variable becomes available to every process started from the command prompt, that is executed by the same user (no impersonation). In case of the Windows Installer, a big part is executed by the Installer service, that uses an account of LOCALSYSTEM.
Further, any process started otherwise doesn't have this variable.
A better approach would be changing the environment variables the official way:
Ask the properties of My Computer, tab Advanced, button Environment Variables. You can set both User variables and System Variables. Anything you set here, will persist over reboots, logons etc.