Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Environment Variables and different user profiles

15 Jun 2015   #1
Sergeant Steve

Windows 7 Ultimate x64
Environment Variables and different user profiles

Couldn't quite find the right thread for this so stuck it in General and figured it would be moved if need be.

I'm wanting some more information on Environment Variables such as %userprofile%. Lets say software will install to %appdata% which relates to C:\Users\(CurrentUser)\appdata, that's fine, but what if this is a standard user profile and the installer gives a UAC prompt for Admin Privileges which are then provided, surely the software installer is now running in the admin user profile so %appdata% would relate to C:\Users\Admin\appdata?

Or is this not possible because you are still in the (Standard) user account therefore the "Environment" is still technically in the standard user rather than the admin.

My System SpecsSystem Spec
15 Jun 2015   #2

Windows 7 Ultimate x64

You're correct in that the path would be deviated when elevating. The "environment" is per-user account, indeed. When elevating though UAC (or by using "run as another user), the launched program will run in the same desktop as everything else (that's why you see it alongside your other programs), but will still be running under different credentials, which means another user account, which means getting its own set of environment variables, security permissions and other things, so it will see the paths for the admin profile, not the standard that launched it.

Within the installer itself, it could be one of two things. The whole process is elevated, so effectively the user will see, within it, the environment of the admin account used to pass UAC, and that will get the buggy behavior you describe. It can also ask for options, folders and everything before elevating, in which case the user will see its own familiar environment, which is in turn passed to the elevated worker process afterwards. Which of those approaches it taken depends entirely on how the installer was made.

The fist behavior I describe is a typical case of a broken installer. Actually, many programs exhibit similar bugs due to assuming that Windows is left at its defaults, and simply fail when those assumptions are not meet (the default being here using an admin account by default and elevation don't requiring an extra password). It's a common flaw of many programs, including some from Microsoft and within Windows itself.

A better option here would be to NOT to ask for elevation at all. Since you want to install to your user profile, you don't require any extra privileges for that, simply copy the files and use (that's the basics of the so-called "portables"). The real reason why installers ask for admin credentials is that they typically deploy to program files, which is read-only for standards, and used system-wide. Your profile is, on the opposite, visible to you only.
I would suggest to use the installer to install to program files, or if you really want to drop it on your profile, use a "portable" version instead.
My System SpecsSystem Spec

 Environment Variables and different user profiles

Thread Tools

Similar help and support threads
Thread Forum
inquiry on Environment variables
I was looking more into Environment Variables and i was wondering if i should add any to the list for USER or just leave it alone: is there any benefit to adding variables for user like performance wise? what is good setup for variables?
Performance & Maintenance
Environment Variables
Hi I set up a User defined Enviro. Var. called GomFolder to be C:\Users|Damo\MyDocuments\NinjaTrader 7 See the attached clip 2015-01-23_1242 - Judge101010's library My understanding is that this should set up a folder called GomFolder in the NinjaTrader 7 folder. Is this correct? If...
General Discussion
Windows 7 Environment variables
Is there an Environment variable that can tell me where the Documents folder is located? Typically, the Documents folder is located in C:\Users\username\Documents. I am creating a batch file to copy 1 file from a remote location (another computer in the network) to the Documents folder. Since...
General Discussion
What are Environment Variables in Computer?
Hey, Can anyone explain are environment variables are within the Advanced System Settings of Computer? I've had to create a new environment variable for a Java complier, and I was just wondering what exactly are environment variables are and why are they used? Thanks, Harry P.S I've...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 02:34.
Twitter Facebook Google+