Hi,
        This is typical behaviour I have seen before. The Msi will be
setting the environment variable by api call, what this will not be
doing is updating the environment of the running process and as Nick
says the batch file will probably be a child of the msi process that
called it.

I solved this in our chainer application by updating the environment of
the process after updating the variable. You could maybe write a custom
action to do this before you call your batch file.

SetEnvironmentVariable..
http://msdn.microsoft.com/en-us/library/ms686206(VS.85).aspx


I did something like this in c#

// Get the write permission to set the environment variable.
EnvironmentPermission environmentPermission = new
EnvironmentPermission(EnvironmentPermissionAccess.Write,
environmentName);
environmentPermission.Demand();
//set for current process only
SetEnvironmentVariable(environmentName, newValue);

Dave

-----Original Message-----
From: John Cooper (Volt) [mailto:a-jc...@microsoft.com] 
Sent: 21 May 2010 23:44
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Environment Variable not set until much too
late

Well, it's certainly not a Wix issue, but environment with batch files
can be affected.  Check out SETLOCAL ENABLEDELAYEDEXPANSION (setlocal
/?). Especially if the environment variables are used in loops, the
standard dereferencing (%some_variable%) will not work properly.
Enabling the above allows the use of delayed expansion with this syntax
(!some_variable!).
--
John M. Cooper
Volt at Microsoft

-----Original Message-----
From: Nick Ramirez [mailto:nickra...@hotmail.com]
Sent: Friday, May 21, 2010 3:17 PM
To: wix-users@lists.sourceforge.net
Subject: Re: [WiX-users] Environment Variable not set until much too
late


Is it possible that the child process (the batch file) is picking up the
same environment as the MSI (parent process?) and in order for it to
pick up the new environment variable it would have to somehow refresh
its environment? 
I'm not sure how to do that.
--
View this message in context:
http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Environmen
t-Variable-not-set-until-much-too-late-tp5076719p5086528.html
Sent from the wix-users mailing list archive at Nabble.com.

------------------------------------------------------------------------
------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------
------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
</pre>
<BR style="font-size:4px;">
<a href = "http://www.sdl.com";><img src="http://www.sdl.com/images/email 
logo_150dpi-01.png" alt="www.sdl.com" border="0"/></a>
<BR>
<font face="arial"  size="2" "><a href = "http://www.sdl.com"; 
style="color:005740; font-weight: bold">www.sdl.com</a>
<BR>
<BR>
<font face="arial"  size="1" color="#736F6E">
<b>SDL PLC confidential, all rights reserved.</b>
If you are not the intended recipient of this mail SDL requests and requires 
that you delete it without acting upon or copying any of its contents, and we 
further request that you advise us.<BR>
SDL PLC is a public limited company registered in England and Wales.  
Registered number: 02675207.<BR>
Registered address: Globe House, Clivemont Road, Maidenhead, Berkshire SL6 7DY, 
UK.
</font>



------------------------------------------------------------------------------

_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to