To make the environment variable accessible globally you need to set it in the registry. As you've realised by just using:

set NEWVAR=SOMETHING

you are just setting it in the current process space.

According to this page you can use the setx command:

setx NEWVAR SOMETHING

setx is built into Windows 7, but for older versions may only be available if you install the Windows Resource Kit

Answer from ChrisF on Stack Exchange
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows-server › administration › windows-commands › set_1
set (environment variable) - Windows commands
Applies to: ✅ Windows Server ... 11, ✅ Windows 10, ✅ Azure Local 2311.2 and later ... Displays, sets, or removes cmd.exe environment variables. If used without parameters, set displays the current environment variable settings. ... This command requires command ...
Discussions

Is there a way to set environment variables that only apply to the command prompt (but to all future sessions)?
I think you can create a batch file that sets the environment variables, and launch it with cmd.exe /k "C:\path\setvars.bat" More on reddit.com
🌐 r/Windows10
5
0
April 14, 2021
command line - Set Environment Variables Windows - Stack Overflow
First off, I'd like to apologise if this has already been covered. It's difficult to filter through all the existing issues similar to this one. So in Windows there is two (as far as I'm aware) wa... More on stackoverflow.com
🌐 stackoverflow.com
Setting a system environment variable from a Windows batch file? - Stack Overflow
Is it possible to set a environment variable at the system level from a command prompt in Windows 7 (or even XP for that matter). I am running from an elevated command prompt. When I use the set c... More on stackoverflow.com
🌐 stackoverflow.com
command line - Adding a directory to the PATH environment variable in Windows - Stack Overflow
Checking the above suggestions on Windows 10 LTSB, and with a glimpse on the "help" outlines (that can be viewed when typing 'command /?' on the cmd), brought me to the conclusion that the PATH command changes the system environment variable Path values only for the current session, but after reboot all the values reset to their default- just as they were prior to using the PATH command. On the other hand using the SETX ... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

How Do I Find Environment Variables in Windows 10?

To find environment variables in Windows 10, you can follow the steps described above to find the environment variable information tucked away inside the system's advanced settings.

Alternatively, if you just need to see what the variables are but don't need to change them, you can simply open a command-line interface by hitting Ctrl +Esc and typing "cmd" in the command box, then type "set" in the command window. This prints out all the environment variables that are set on your system.

🌐
alphr.com
alphr.com › home › how to set environment variables in windows 10
How to Set Environment Variables in Windows 10
Why Can't I Edit the Environment Variables?

There are several reasons that you may not be able to set these variables.

1. The first of your problems could be that you don't have Admin rights. To set or edit this function, you must be the Administrator of the system.

2. If you are the Admin, yet the edit function is greyed out, try accessing the Environment Variables by accessing the Control Panel from the Start menu. Click on Advanced System Settings, then click Environment Variables.

🌐
alphr.com
alphr.com › home › how to set environment variables in windows 10
How to Set Environment Variables in Windows 10
🌐
Computer Hope
computerhope.com › issues › ch000549.htm
How to Set the Path and Environment Variables in Windows
You can edit other environment variables by highlighting the variable in the System variables section and clicking Edit. If you need to create a new environment variable, click New, and enter the variable name and value. ... To view and set the path through the Windows command line, use the path command.
🌐
Open Tech Guides
opentechguides.com › how-to › article › windows-10 › 113 › windows-10-set-path.html
Set PATH and other environment variables in Windows 10
December 12, 2016 - By default setx sets the variable in the local environment (Under HKEY_Current_User Registry key). If you want to set the system variable (Under HKEY_LOCAL_MACHINE registry key), use the flag /m. Start the command prompt as administrator on Windows 10, right click on Start menu and select Command ...
🌐
Alphr
alphr.com › home › how to set environment variables in windows 10
How to Set Environment Variables in Windows 10
October 15, 2022 - Alternatively, if you just need to see what the variables are but don’t need to change them, you can simply open a command-line interface by hitting Ctrl +Esc and typing “cmd” in the command box, then type “set” in the command window.
🌐
Sigasi
sigasi.com › knowledge › how_tos › setting-environment-variables
Setting Environment Variables - Sigasi
September 23, 2024 - In the System Properties window, click on Environment Variables. In the User variables or System variables section: Click New to add a new variable. Click Edit to modify an existing variable. Click Delete to remove a variable. Enter the variable name and value, then click OK. Note: User variables apply only to the current user, while system variables apply to all users on the machine. Open Command Prompt or PowerShell with administrator rights.
Find elsewhere
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to set environment variable in windows
How to Set Environment Variables in Windows
December 9, 2025 - To add a system-wide environment variable, open the Command Prompt as administrator and use: ... To unset an environment variable using the GUI, follow the steps in the section on setting environment variables via GUI to reach the Environment Variables window.
🌐
How-To Geek
howtogeek.com › home › windows › how to use windows cmd environment variables
How to Use Windows CMD Environment Variables
April 8, 2022 - All you need to do is substitute the system variable you want to change in place of LifeAnswerVar, and the value you want to assign in place of 42. As an example, if you wanted to move the TMP folder to C:\Example Folder, you'd enter the command ... , shows the current value of TMP. The second line assigns TMP a new value. The third line confirms that it has changed. The second way uses setx. Setx defines Windows environment variables permanently.
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows-server › administration › windows-commands › setx
setx | Microsoft Learn
February 3, 2023 - The Setx command also retrieves the values of registry keys and writes them to text files. ... This command provides the only command-line or programmatic way to directly and permanently set system environment values.
Top answer
1 of 9
179

Note: After seeing lots of comments about setting environment variables without administrator rights in Windows 10, I think I have found a way. I was not administrator and could use PowerShell.

PowerShell method

You can list all environment variables with: Get-ChildItem Env:.

To get the value of a specific variable: $Env:PATH, where PATH is the name of the variable.

To set a variable: [Environment]::SetEnvironmentVariable("PATH", "C:\TestPath", "User"), the first parameter is the name of the variable, the second is the value, the third is the level of.

There are different ways to work with environment variables and certain quirks with them in PowerShell so consult the link for details.

Old method (no longer available in newer Windows 10 updates, use PowerShell or see other answers)

Go into Settings and click on System.

Then on the left side click About and select System info at the bottom.

In the new Control Panel window that opens, click Advanced system settings on the left.

Now in the new window that comes up, select Environment Variables... at the bottom.

2 of 9
127

Still the same as ever: It’s in the old-style control panel’s “System” thingy. You can reach it with WinBreak or by right-clicking the Start button.

From there, select “Advanced system settings” → “Environment Variables”.

Or you can do it the hard way and find some other entry point to the old-style control panel, like the Network and Sharing Center or the Desktop folder(!).

🌐
SS64
ss64.com › nt › set.html
Set - Environment Variable command - Windows CMD
SET /A "_result=2+4" (=6) SET /A "_result=5" (=5) SET /A "_result+=5" (=10) SET /A "_result=2<<3" (=16) { 2 Lsh 3 = binary 10 Lsh 3 = binary 10000 = decimal 16 } SET /A "_result=5%%2" (=1) { 5/2 = 2 + 2 remainder 1 = 1 } SET /A "_var1=_var2=_var3=10" (sets 3 variables to the same value - ...
🌐
Winaero
winaero.com › home › windows 10 › create environment variable in windows 10
Create Environment Variable in Windows 10
March 9, 2019 - See Create Environment Variables Shortcut in Windows 10. Also, there's a special RunDLL command that you can use (Press Win + R and copy-paste it to the Run box): ... Finally, you can right-click the This PC icon in File Explorer and select Properties from the context menu. Click the "Advanced System Settings...
🌐
Dowdandassociates
dowdandassociates.com › blog › content › howto-set-an-environment-variable-in-windows-command-line-and-registry
HowTo: Set an Environment Variable in Windows - Command Line and Registry - Dowd and Associates
December 2, 2011 - You can use environment variables in the values of other environment variables. It is then helpful to be able to see what environment variables are set already. This is how you do it: ... To set persistent environment variables at the command line, we will use setx.exe.
Top answer
1 of 16
1265

Option 1

After you change PATH with the GUI, close and reopen the console window. This works because only programs started after the change will "see" the new PATH. This is because when you change the PATH environment variable using the GUI tool, it updates the variable for future processes but not for anything currently running.

Option 2

This option only affects your current shell session, not the whole system. Execute this command in the command window you have open:

set PATH=%PATH%;C:\your\path\here\

This command appends C:\your\path\here\ to the current PATH. If your path includes spaces, you do not need to include quotation marks.

Breaking it down:

  • set – A command that changes cmd's environment variables only for the current cmd session; other programs and the system are unaffected.
  • PATH= – This signifies that PATH is the environment variable to be temporarily changed.
  • %PATH%;C:\your\path\here\ – The %PATH% part expands to the current value of PATH, and ;C:\your\path\here\ is then concatenated to it. This becomes the new PATH.
2 of 16
291

WARNING: This solution may be destructive to your PATH, and the stability of your system. As a side effect, it will merge your user and system PATH, and truncate PATH to 1024 characters. The effect of this command is irreversible. Make a backup of PATH first. See the comments for more information.

Don't blindly copy-and-paste this. Use with caution.

You can permanently add a path to PATH with the setx command:

setx /M path "%path%;C:\your\path\here\"

Remove the /M flag if you want to set the user PATH instead of the system PATH.

Notes:

  • The setx command is only available in Windows 7 and later.
  • You should run this command from an elevated command prompt.

  • If you only want to change it for the current session, use set.

🌐
How-To Geek
howtogeek.com › home › windows › how to edit environment variables on windows 11
How to Edit Environment Variables on Windows 10 or 11
September 23, 2025 - Editing your PC's environment variables can save you time in Command Prompt and make your scripts more concise. It also lets you customize where Windows stores certain files. This is what you need to know about getting started adding, editing, or removing entries from your Environment Variables on Windows. Environment variables can be used to point to or set important directories, like the location of the Windows Temp folder, or they can they relay important information about your PC, like the version of Windows it is running or the number of processor cores it has available.
🌐
Windows 10 Forums
tenforums.com › tutorials › 121664-set-new-user-system-environment-variables-windows.html
Set New User and System Environment Variables in Windows - Windows 10 Help Forums
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.