- Revenera Community
- InstallShield Forum
- Re: Adding system OR current user environment variable like HKEY_USER_SELECTABLE?
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Printer Friendly Page
Adding system OR current user environment variable like HKEY_USER_SELECTABLE?
I want to add an environment variable to install with my application. I want it to install to the System area of the environment variables if the person doing the installation has administrative privileges. But if not, I want it to place the environment variable into the current User area.
I can't figure out how to accomplish this easily?! In the Environment Variables view, when you add a variable, the only option for "Type" is "System" or "User". If I choose "System" and try to install as a normal user with privileges, I get an error during the installation process, near the end about not being able to add the environment variable.
Doesn't it make sense to have an option like the registry has (and which I take advantage of) to place registry keys in HKEY_USER_SELECTABLE? That's easy!
If I'm overlooking something and there is an easy way, please let me know.
You could make an install script where you set the environmental variables using Powershell, or package an MSI using Adminstudio where you also set registry keys to set variables at the HKEY_CURRENT_USER\Environment (user variables) or HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment (system variables)