likm
likm

Reputation:

How to set user environment variables in Windows Server 2008 R2 as a normal user?

In older versions of Windows, it was just open the Control Panel, select the System applet, select the Advanced tab, and then hit the Environment variables button. As a normal user, you could edit the "User variables" but not the "System variables".

In Windows Server 2008 R2, if I try to hit the Advanced System settings option in the System applet, it prompts for the Administrator password.

Upvotes: 68

Views: 253354

Answers (8)

user3347790
user3347790

Reputation: 133

There are three ways

1) This runs the GUI editor for the user environment variables. It does exactly what the OP wanted to do and does not prompt for administrative credentials.

rundll32.exe sysdm.cpl,EditEnvironmentVariables

(bonus: This works on Windows Vista to Windows 10 for desktops and Windows Server 2008 through Server 2016. It does not work on Windows NT, 2000, XP, and 2003. However, on the older systems you can use sysdm.cpl without the ",EditEnvironmentVariables" parameter and then navigate to the Advanced tab and then Environment Variables button.)

2) Use the SETX command from the command prompt. This is like the set command but updates the environment that's stored in the registry. Unfortunately, SETX is not as easy to use as the built in SET command. There's no way to list the variables for example. Thus it's impossible to do something such as appending a folder to the user's PATH variable. While SET will display the variables you don't know which ones are user vs. system variables and the PATH that's shown is a combination of both.

3) Use regedit and navigate to HKEY_CURRENT_USER\Environment

Keep in mind that changes to the user's environment does not immediately propagate to all processes currently running for that user. You can see this in a command prompt where your changes will not be visible if you use SET. For example

rem Add a user environment variable named stackoverflow that's set to "test"
setx stackoverflow test
set st

This should show all variables whose names start with the letters "st". If there are none then it displays "Environment variable st not defined". Exit the command prompt and start another. Try set st again and you'll see

stackoverflow=test

To delete the stackoverflow variable use

setx stackoverflow ""

It will respond with "SUCCESS: Specified value was saved." which looks strange given you want to delete the variable. However, if you start a new command prompt then set st will show that there are no variables starting with the letters "st"

(correction - I discovered that setx stackoverflow "" did not delete the variable. It's in the registry as an empty string. The SET command though interprets it as though there is no variable. if not defined stackoverflow echo Not defined says it's not defined.)

Upvotes: 2

likm
likm

Reputation:

OK I found it. Arg, an exercise in frustration. They left the old window menu traversal path for changing environment variables in there, but limited access to administrators only. As a normal user, if you want to change it, you need to go through a different set of options to arrive at the same frigging window.

Control Panel -> User Accounts -> User Accounts -> Change my environment variables.

Upvotes: 67

salim ali
salim ali

Reputation: 21

I created a godmode folder on the desktop. just create a new folder on the desktop and call it GodMode.{ED7BA470-8E54-465E-825C-99712043E01C} it will name the folder as godmode and populate the content with various config options, you can then just type in ENVIRO in the search to find the relevant config option, open it and it opens sysdm.cpl in the advanced tab, you can change the environment variables from there.

Upvotes: 2

excitoon
excitoon

Reputation: 450

In command line prompt:

set __COMPAT_LAYER=RUNASINVOKER
SystemPropertiesAdvanced.exe

Now you can set user environment variables.

Upvotes: 2

TimT
TimT

Reputation: 151

This can be done from the command line using the SETX command. For example to 'move' your temporary files to another disk:

SETX TEMP d:\tmp

Upvotes: 5

AlexCode
AlexCode

Reputation: 4123

You can also use this direct command line to open the Advanced System Properties:

sysdm.cpl

Then go to the Advanced Tab -> Environment Variables

Upvotes: 90

h0r41i0
h0r41i0

Reputation: 234

Under "Start" enter "environment" in the search field. That will list the option to change the system variables directly in the start menu.

Upvotes: 6

Edgard Concha
Edgard Concha

Reputation: 319

Step by step instructions:

  • Go to Control Panel \System and Security\System
  • Click on Change Settings
  • Go to “Advance” tab
  • Click on Environment Variables

Upvotes: 21

Related Questions