AppDeploy.com

 


set an environment variable

Click here to associate this thread with a Package KB article.
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [AppDeploy Forums] >> Package Development >> set an environment variable Page: [1]
Login
Message << Older Topic   Newer Topic >>
set an environment variable - 5/24/2006 4:33:54 PM   
fosteky

 

Posts: 97
Score: 3
Joined: 4/26/2006
Status: offline
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.
Post #: 1
RE: set an environment variable - 5/25/2006 4:34:45 AM   
MSIPackager


Posts: 724
Score: 43
Joined: 7/29/2004
From: UK
Status: offline
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.


< Message edited by MSIPackager -- 5/25/2006 4:35:32 AM >

(in reply to fosteky)
Post #: 2
RE: set an environment variable - 5/25/2006 8:52:06 PM   
fosteky

 

Posts: 97
Score: 3
Joined: 4/26/2006
Status: offline
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

(in reply to MSIPackager)
Post #: 3
Page:   [1]
All Forums >> [AppDeploy Forums] >> Package Development >> set an environment variable Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.031