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.
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)
Please log in to answer
Posted by:
MSIPackager
18 years ago
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.
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
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
%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.
so that the conversation will remain readable.