/build/static/layout/Breadcrumb_cap_w.png

set an environment variable

Hi All,

I have re-packaged an application (SAP GUI 6.2) which requires an environmental variable (EnVar) be set, which I set within the MSI. This works fine once the user has launched the app (thereby installing it) and logged out and back in. But because the package is user assigned and comes as an advertised install - the EnVar doesn't set itself until the user logs off and logs on, which is when Windows reads its EnVars. The program install perfectly when the user launches the advertised shortcut, but the EnVar doesn't get set until the user logs off and back on. So I tried the following at the command line:
SET SAPLOGON_INI_FILE=%APPDATA%\SAP\SAPLOGON.INI
but even though it shows as being set (when I type SET at a command prompt), the application doesn't (resolve?) the EnVar. So I have two questions:
Does anyone know how to instantly set a User Environmental Variable so that it will resolve for the user right away?
If so, am I on the correct path in thinking that I can create a Custom Action that will set this right away, thereby doing away with the current need for the user to logoff and back on for the EnVar to set?

Any help here would be very appreciated.

0 Comments   [ + ] Show comments

Answers (2)

Posted by: MSIPackager 18 years ago
3rd Degree Black Belt
0
Hmm whenever I've set Environment Variables within an MSI they take effect immediately...

Presuming you using the Environment Table to create them - ensure you have the correct prefixes in the name column (e.g. * for a W2k or XP variable / = to create and set during install / - to remove on uninstall etc)

Check out the SDK for all the options...

Hope this helps,
Rob.
Posted by: fosteky 18 years ago
Purple Belt
0
Thanks MSIPackager, you sent me on the right path. What ended up working for me was changing the value in the Environment table for my Environment Variable from:
%APPDATA%\SAP\SAPLOGON.INI
to:
[%APPDATA]\SAP\SAPLOGON.INI

Which I guess forced Installer to determine the path of the APPDATA property before writing it into the user Enviroment Variables and voila, it worked. Whereas before it was just putting the plain old verbatim text of %APPDATA%\SAP\SAPLOGON.INI into the value of the user's Environment Variable, which meant Windows had to resolve it - which only seems to happen when Windows starts.

Thanks again - you got me looking in the right spot.

-Kyle
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ