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. Deleting the system variable environment

    in Windows 10 Gaming
    Deleting the system variable environment: I unconsciously deleted all rows and items in the system variable environment setting in windows 11 and right now when I want to go for the Clean install of Windows 11 using installation media and click on the media creation tool in my flash memory, I face this error: "the...
  3. Environment Variables, User variables for System Admin

    in Windows 10 Gaming
    Environment Variables, User variables for System Admin: I was looking at the 'User variables for System Admin' one day and saw my name spelled '*****'. I didn't care for that name and without thinking changed the name. Now all my music, photos & docs are gone. How can I undo that already tried 'System Restore'?...
  4. Environment Variables, User variables for System Admin

    in Windows 10 Software and Apps
    Environment Variables, User variables for System Admin: I was looking at the 'User variables for System Admin' one day and saw my name spelled '*****'. I didn't care for that name and without thinking changed the name. Now all my music, photos & docs are gone. How can I undo that already tried 'System Restore'?...
  5. Environment Variables, User variables for System Admin

    in Windows 10 Network and Sharing
    Environment Variables, User variables for System Admin: I was looking at the 'User variables for System Admin' one day and saw my name spelled '*****'. I didn't care for that name and without thinking changed the name. Now all my music, photos & docs are gone. How can I undo that already tried 'System Restore'?...
  6. regarding path variable of user variable of environment variable

    in Windows 10 Customization
    regarding path variable of user variable of environment variable: please help me fast, I accidentally deleted path variable of user variable ..... I want to restore it. the real situation is I cannot run android studio project and it shows error - " unable to start daemon process............This problem might be caused by incorrect...
  7. System Environment variables

    in Windows 10 Customization
    System Environment variables: Hello! I have been trying to run executable programs using command prompt since a long time, added the path names to the System and user environment variables as well. But it is not helping, the command prompt is unable to run any file except the inbuilds such as notepad....
  8. 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....
  9. 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...
  10. 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...