Windows 10: Set New User and System Environment Variables in Windows

Discus and support Set New User and System Environment Variables in Windows in Windows 10 Tutorials to solve the problem; How to: Set New User and System Environment Variables in Windows How to Set New User and System Environment Variables in Windows Environment... Discussion in 'Windows 10 Tutorials' started by NJMorf, Oct 23, 2016.

  1. NJMorf Win User

    Set New User and System Environment Variables in Windows


    How to: Set New User and System Environment Variables in Windows

    How to Set New User and System Environment Variables in Windows


    Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can be used both in scripts and on the command line. Environment variables makes it easy when certain standard directories and parameters need to be referenced but where the actual locations or names can vary from computer to computer.

    The variable (ex: "%UserProfile%") is used as a type of shortcut of the value (ex: "C:\Users\<username>").

    There are two types of environment variables: user environment variables (set only for current user) and system environment variables (set for all users).

    This tutorial will show you how to set (create) new user and system environment variables in Windows 7, Windows 8, and Windows 10.


    Set New User and System Environment Variables in Windows [​IMG]
    Note User environment variables are stored in the HKEY_CURRENT_USER\Environment registry key.

    System environment variables are stored in the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment registry key.



    CONTENTS:
    • Option One: Set New User Environment Variables in Environment Variables
    • Option Two: Set New User Environment Variables in Command Prompt
    • Option Three: Set New User Environment Variables in PowerShell
    • Option Four: Set New System Environment Variables in Environment Variables
    • Option Five: Set New System Environment Variables in Command Prompt
    • Option Six: Set New System Environment Variables in PowerShell




    OPTION ONE [/i] Set New User Environment Variables in Environment Variables
    1. Open the Control Panel (icons view), and click/tap on the User Accounts icon.

    2. Click/tap on the Change my environment variables link on the left side, and close the User Accounts control panel window if you like. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]

    3. Click/tap on the New button under the top User variables for <current user name> section. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]

    4. Enter a variable name you want to use, enter a variable value you want to use, and click/tap on OK. (see screenshot below)

    *note If you like, you could click/tap on the Browse Directory button to navigate to and select a directory to have its path entered for the variable value.

    If you like, you could click/tap on the Browse File button to navigate to and select a file to have its path entered for the variable value.


    Set New User and System Environment Variables in Windows [​IMG]

    5. When finished creating new user variables, click/tap on OK to apply (set) the new variables. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]






    OPTION TWO [/i] Set New User Environment Variables in Command Prompt
    1. Open a command prompt.

    2. Type the command below into the command prompt, and press Enter. (see screenshot below)
    *Arrow setx [variable name] "[variable value]"

    *note Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to use.

    Substitute [variable value] in the command above with the actual variable value (ex: "C:\Users\Brink\Downloads") you want to use.

    3. You can now close the command prompt if you like.


    Set New User and System Environment Variables in Windows [​IMG]






    OPTION THREE [/i] Set New User Environment Variables in PowerShell
    1. Open Windows PowerShell.

    2. Type the command below into PowerShell, and press Enter. (see screenshot below)
    *Arrow [Environment]::SetEnvironmentVariable("[variable name]","[variable value]","User")

    *note Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to use.

    Substitute [variable value] in the command above with the actual variable value (ex: "C:\Users\Brink\Downloads") you want to use.

    3. You can now close Windows PowerShell if you like.


    Set New User and System Environment Variables in Windows [​IMG]






    OPTION FOUR [/i] Set New System Environment Variables in Environment Variables

    *note You must be signed in as an administrator to do this option.
    1. Open the Control Panel (icons view), and click/tap on the System icon.

    2. Click/tap on the Advanced system settings link on the left side, and close the System control panel window if you like. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]

    3. Click/tap on the Environment Variables button. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]

    4. Click/tap on the New button under the bottom System variables section. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]

    5. Enter a variable name you want to use, enter a variable value you want to use, and click/tap on OK. (see screenshot below)

    *note If you like, you could click/tap on the Browse Directory button to navigate to and select a directory to have its path entered for the variable value.

    If you like, you could click/tap on the Browse File button to navigate to and select a file to have its path entered for the variable value.


    Set New User and System Environment Variables in Windows [​IMG]

    6. When finished creating new system variables, click/tap on OK to apply (set) the new variables. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]

    7. Click/tap on OK. (see screenshot below)

    Set New User and System Environment Variables in Windows [​IMG]






    OPTION FIVE [/i] Set New System Environment Variables in Command Prompt

    *note You must be signed in as an administrator to do this option.
    1. Open an elevated command prompt.

    2. Type the command below into the elevated command prompt, and press Enter. (see screenshot below)
    *Arrow setx [variable name] "[variable value]" -M

    *note Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to use.

    Substitute [variable value] in the command above with the actual variable value (ex: "%UserProfile%\Downloads") you want to use.

    3. You can now close the elevated command prompt if you like.


    Set New User and System Environment Variables in Windows [​IMG]






    OPTION SIX [/i] Set New System Environment Variables in PowerShell

    *note You must be signed in as an administrator to do this option.
    1. Open an elevated Windows PowerShell.

    2. Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)
    *Arrow [Environment]::SetEnvironmentVariable("[variable name]","[variable value]","Machine")

    *note Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to use.

    Substitute [variable value] in the command above with the actual variable value (ex: "%UserProfile%\Downloads") you want to use.

    3. You can now close the elevated Windows PowerShell if you like.


    Set New User and System Environment Variables in Windows [​IMG]


    That's it,
    Shawn


    Related Tutorials

    :)
     
    NJMorf, Oct 23, 2016
    #1
  2. MCK
    mck Win User

    System environment variable won't stick


    Running Win10 Home on an Acer Spin 3, 64bit, i7cpu. I try to add a path to the system environment variables by:

    1. Control Panel > System > Advanced system settings > Advanced tab > Environment variables

    2. The "Environment Variables" window opens.
    3. In the "System Variables" pane I select "Path" and click the EDIT button.
    4. A list of the current system paths is displayed.
    5. I click the NEW button, browse to the path I want to add which is "C:\Python36-32" and click OK. The path "C:\Python36-32" is added to the list of current system paths.
    6. I click OK and am returned to the "Environment Variables" window.
    7. I click the "X" at the top right to close the "Environment Variables" window.

    Now if I click the "Environment Variables" button again (end of step-1) and repeat steps 2-4, the new path I added in step-5 is gone. IOW, adding a new path won't stick.

    What am I doing wrong?
     
  3. no longer able to set User's environment variables in control panel

    Hello,

    Thank you for posting your concern in Microsoft Community and welcome to the Windows 10 Family.

    From the description provided, I understand that you are not able to work on the Environment Variables in Windows 10 after the latest update to build 10586.3.

    The path to access the Environment variables in Windows would be:

    Control panel -> System -> Advanced System Settings -> Advanced -> Environment variables.

    However, if the above is still in place, but however, you still face functionality issue, I would suggest you to rollback to the previous build and check if it helps.

    Follow the below steps:

    • Click on Start and select Settings and then choose Update & security.
    • Then click on ‘Recovery Options’.
    • Click on the ‘Get started’ button in the ‘Go back to a previous build of Windows’ option to start the recovery process.
    Hope the above information is helpful. If you need further information, feel free to write t us and we would be happy to help you.

    Thank you.
     
    Sayan_Ghosh, Oct 27, 2019
    #3
  4. Set New User and System Environment Variables in Windows

    Kapil Arya MVP, Oct 27, 2019
    #4
  5. ustulo Win User
    Edit Environment Variables of Standard User Account

    In Windows 10, how can I set user-level (not system wide) environment variables for a standard user account? To clarify: I'm not talking about editing system environment variables. Also, just running the System app in Control Panel as admin won't work because
    that would set the environment variables for that admin user.

    When I go to Control Panel -> User Accounts, then click the "Change my environment variables" link in the left-hand action pane, nothing happens.

    If I go to the search box on the task bar and type "environment", then click "Edit environment variables for your account", nothing happens.

    Currently I have JAVA_HOME set to an incorrect value in my user account, which is a standard user not an admin. If I edit environment variables as admin, it does not show up in the system environment variables nor in the user environment variables (since
    the Administrator account is a different user).
     
    ustulo, Oct 27, 2019
    #5
  6. Jose Est Win User
    User environment variables recovery

    Hi Haoran,

    The system environment block represents environment variables for all users of the particular computer. A user's environment block represents the environment variables the system maintains for that particular user, including the set of system environment
    variables.

    That being said, there might have been a conflict with your user environment variables after renaming your PC.

    To have your user environment variables issue addressed, we highly recommend posting it to our
    TechNet Forum which caters IT professionals who are actively answering these types of concerns. Click
    here to post your issue.

    If you have other concerns, don't hesitate to get back to us.
     
    Jose Est, Oct 27, 2019
    #6
Thema:

Set New User and System Environment Variables in Windows

Loading...
  1. Set New User and System Environment Variables in Windows - Similar Threads - Set User System

  2. Help with environment variables

    in Windows 10 Customization
    Help with environment variables: A while back, I made some changes to my environment variables (not realizing this was a bad idea), and Path system variable had system 32 removed (as well as others). This has caused me issues running commands from CMD, however, even after adding the path back and restarting,...
  3. Need to edit user environment variables on Windows 10.

    in Windows 10 Customization
    Need to edit user environment variables on Windows 10.: Is it possible to edit user environment variables on Windows 10 Home 1809? Past procedures don't work and solutions found on internet don't work....
  4. Setting path variable in Environment variables Windows 10

    in Windows 10 Customization
    Setting path variable in Environment variables Windows 10: How can I stack up multiple path variables? Currently, it overwrites the old one when I try to edit. (I believe mindless updates are bad and updates should only happen when it is reasonably certain they will improve usability, and not just so that some people have a job.)...
  5. User Environment Variable

    in Windows 10 Software and Apps
    User Environment Variable: Created an User Environment variable in Environment variable page in UI. It is seen in both UI and command prompt(Using set command). After restart it is not seen in command prompt when set command is used. Please help....
  6. Environment Variables

    in Windows 10 BSOD Crashes and Debugging
    Environment Variables: what will happen if i accidentally delete one of those environment variables without realizing it ? and how to fix it ? https://answers.microsoft.com/en-us/windows/forum/all/environment-variables/fedbdf36-ce8e-4861-a775-1dc62dd1c67e
  7. environment variables missing

    in AntiVirus, Firewalls and System Security
    environment variables missing: i also got error message 80007000cb https://answers.microsoft.com/en-us/protect/forum/protect_defender-protect_updating-windows_10/environment-variables-missing/dad217b7-71e5-47d8-8569-4ab5e6380287
  8. Edit User and System Environment Variables in Windows

    in Windows 10 Tutorials
    Edit User and System Environment Variables in Windows: How to: Edit User and System Environment Variables in Windows How to Edit User and System Environment Variables in Windows Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can be...
  9. Delete User and System Environment Variables in Windows

    in Windows 10 Tutorials
    Delete User and System Environment Variables in Windows: How to: Delete User and System Environment Variables in Windows How to Delete User and System Environment Variables in Windows Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can...
  10. System environment variable won't stick

    in Windows 10 Support
    System environment variable won't stick: Running Win10 Home on an Acer Spin 3, 64bit, i7cpu. I try to add a path to the system environment variables by: 1. Control Panel > System > Advanced system settings > Advanced tab > Environment variables 2. The "Environment Variables" window opens. 3. In the "System...