/build/static/layout/Breadcrumb_cap_w.png

Creating Environment Variables for all users

Vista introduces a new environment variable called LOCALAPPDATA which doesnt exist on XP so I have to create it in an installer with InstallShield. This has to be a user environment variable as far as I know. Here comes 2 questions;

1. I want this environment variable to be available to all users. But if I put this under (type) system variables, %LOCALAPPDATA% doesnt work. If I put this under (type) user variables then it works. However, it will only create this for the user that installs the application. So how can I make this available to all users? Can IS help with this?

2. Since this environment already exists on Vista, I would like create it on XP only. I dont think IS enables me to put conditions directly environment variables table, right? Maybe I can do this, create an empty component and associate with this environment variable, and put a condition on the component so that it gets installed on XP only and doesnt overwrite the existing variable on Vista. Can anyone think of a better way?

Thanks!

0 Comments   [ + ] Show comments

Answers (2)

Posted by: michaelnowell 15 years ago
Second Degree Blue Belt
0
So are you trying to create an Environment Variable on all of your XP machines called 'LOCALAPPDATA' so that you can use this variable in your packages to install specific files into this location? Or do you need it there for something else?

If you need it for your packages, I know that within Wise (someone will have to clarify this for me within IS) there is a directory called LocalAppDataFolder that you can use which will direct files to the same location.
Posted by: anonymous_9363 15 years ago
Red Belt
0
ORIGINAL: JoderCoder
1. I want this environment variable to be available to all users. But if I put this under (type) system variables, %LOCALAPPDATA% doesnt work. If I put this under (type) user variables then it works.
That's because System variables are only activated after a reboot, because for some reason MS has omitted to have the WI engine propogate the message that the machine environment has changed.

In any event, why do you need to recreate the variable? It would be neater to create a custom property and use a SetProperty CA with a condition, setting it in XP to use '%USERPROFILE%\Local Settings\Application Data' or to just '%LOCALAPPDATA%' in Vista. Alternatively, find where in the package that variable is used and again substitute the appropriate location via a suitable condition. Either of these routes allow you to keep in step with MS's whims: almost without question, the next Windows release will have additional and/or changed EVs - how will you cope then? Always be defensive and try to think ahead. Sometimes, taking the longer route now will save you time in the future.
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