This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- GetEnvVar not working?
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 11, 2012
09:36 AM
GetEnvVar not working?
Hello all, having a problem passing data into an InstallScript-driven installer.
I run IsCmdBld using NAnt and TeamCity. The following NAnt snippet:
Does as it should, echoing the environment variable that was set to the value of the system.spam.spam variable (which TeamCity passes to NAnt as spam.spam).
However, when I run IsCmdBld:
on an ISM that has the following script code:
I get a blank message box. I had expected the text of the message box to contain the same value as was echoed in the first NAnt snippet. The same thing occurs if I use an environment variable in TeamCity directly (instead of setting one on the fly in the NAnt script), it seems to be ignored entirely. Am I missing something vital?
Thanks
I run IsCmdBld using NAnt and TeamCity. The following NAnt snippet:
Does as it should, echoing the environment variable that was set to the value of the system.spam.spam variable (which TeamCity passes to NAnt as spam.spam).
However, when I run IsCmdBld:
...
on an ISM that has the following script code:
STRING Flavor;
GetEnvVar("TESTTEST", Flavor);
MessageBox(Flavor, WARNING);
I get a blank message box. I had expected the text of the message box to contain the same value as was echoed in the first NAnt snippet. The same thing occurs if I use an environment variable in TeamCity directly (instead of setting one on the fly in the NAnt script), it seems to be ignored entirely. Am I missing something vital?
Thanks
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 16, 2012
02:27 PM
The GetEnvVar function is a thin wrapper around the Win32 GetEnvironmentVariable API. As long as the requested variable is set for the InstallScript setup process, this API should return the value as expected.
You may try using the Process Explorer utility from www.sysinternals.com to see what environment variables are available to the running InstallScript setup process as a way to further troubleshoot this issue. Typically, a launched process inherits the launching process' environment block unless a new one is provided explicitly to CreateProcess (in other words, the process that was launched has no control over the environment block it receives).
You may try using the Process Explorer utility from www.sysinternals.com to see what environment variables are available to the running InstallScript setup process as a way to further troubleshoot this issue. Typically, a launched process inherits the launching process' environment block unless a new one is provided explicitly to CreateProcess (in other words, the process that was launched has no control over the environment block it receives).
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Apr 18, 2012
02:48 PM
Thanks Josh, this is apparently related to how CreateProcess works differently for executables vs. batch files; wrapping the call to IsCmdBld in a batch file allowed InstallShield to see the environment variable being set during the exec task.