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
These settings usually include the COMSPEC and PATH environment variables, which are used to help find programs on disk. Two other environment variables used by Windows are PROMPT and DIRCMD.
Discussions

windows - Set a persistent environment variable from cmd.exe - Stack Overflow
I have to set environment variables on different windows machines, but I don't want to be bothered changing them manually by getting on the properties screen of "My Computer" I want to do... More on stackoverflow.com
🌐 stackoverflow.com
cmd - How do i view my environment variables in Windows 10 VS Code or PyCharm terminal? - Stack Overflow
I'm on Windows 10 trying to code in Python and store variables into environment variables. When I do 'set example=123', the command goes through with no issues that i can see, but when i go to type... More on stackoverflow.com
🌐 stackoverflow.com
Environment Variable Setting via Command Line
Is there a command line I can use to set PC and Server environment variables? I have several I have to type in often. It would be nice to write a script to enter them for me. More on community.spiceworks.com
🌐 community.spiceworks.com
12
6
July 28, 2022
Someone please help me understand what $PATH is and how to change it
A lot of these answers are just saying what a variable is but don't really say what $PATH is specifically. $PATH is a list of directories that are checked for executables. So when you type ls into your terminal, the ls executable is looked for in the directories in $PATH and then is executed. More on reddit.com
🌐 r/linux4noobs
24
68
July 25, 2022
🌐
NTU Singapore
www3.ntu.edu.sg › home › ehchua › programming › howto › Environment_Variables.html
Environment Variables for Java Applications - PATH, CLASSPATH, JAVA_HOME
An environment variable set via the "set" command under CMD is a local, available to the current CMD session only. Try setting a variable, re-start CMD and look for the variable. To reference a variable in Windows, use %varname% (with prefix and suffix of '%').
🌐
NinjaOne
ninjaone.com › home › blog › it ops › how to view and manage environment variables in windows
How to View and Manage Environment Variables In Windows | NinjaOne
March 12, 2026 - This method is fast and helpful for quick checks and script-based automation. Press Win + R to open the Run dialog box. Type cmd and click Enter to open the Command Prompt. To view all current environment variables: Type set and press Enter.
🌐
How-To Geek
howtogeek.com › home › windows › how to use windows cmd environment variables
How to Use Windows CMD Environment Variables
April 8, 2022 - First, you need to launch Command Prompt, or CMD, as an administrator. Click Start, type "cmd" into the search box, and then click "Run as Administrator." Any user environment variable can be set or modified in a regular Command Prompt window, but changing system-wide environment variables requires an elevated Command Prompt.
🌐
SS64
ss64.com › nt › syntax-variables.html
Windows Environment Variables - Windows CMD
How-to: Array Variables in CMD. How-to: User Shell Folders - Profile, Start Menu - Location of user profile folders. How-to: Detecting 32 vs 64 bit Windows. CALL - Evaluate environment variables. SET - View environment variables, set local variables. SETX - Set environment variables.
Find elsewhere
🌐
Medium
kevinlinxc.medium.com › viewing-and-setting-environment-variables-in-every-shell-4df43127bd8
Viewing and Setting Environment Variables in Every Shell | by Kevin Lin | Medium
September 11, 2023 - # list all environment variables printenv # fetch a specific environment variable echo $VariableName # pretty print the PATH variable (one path per line) echo $PATH | tr ':' '\n' # set an environment variable for the current session export VariableName=Value # delete an environment variable for the current session unset VariableName
🌐
Foundry
learn.foundry.com › nuke › content › comp_environment › configuring_nuke › environment_variables.html
Environment Variables - Foundry Learn
In both cases, VARIABLE should be replaced by the environment variable you're interested in. For example, NUKE_TEMP_DIR on Windows returns:
🌐
GitHub
gist.github.com › RebeccaWhit3 › 5dad8627b8227142e1bea432db3f8824
Complete List of Environment Variables in Windows 10 · GitHub
List of Rundll32 Commands for Windows 10 · Copy link · Copy Markdown · Some Environmental Variables is not listed set. here is list. cd · cmdcmdline · cmdextversion · date · errorlevel · logonserver · random · time · they can override ...
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows-server › administration › windows-commands › setx
setx | Microsoft Learn
February 3, 2023 - System environment variables are manually configurable through Control Panel or through a registry editor. The set command, which is internal to the command interpreter (Cmd.exe), sets user environment variables for the current console window only.
🌐
Sigasi
sigasi.com › knowledge › how_tos › setting-environment-variables
Setting Environment Variables - Sigasi
September 23, 2024 - Environment variables are key-value pairs used by operating systems to define the environment in which programs run. Below are step-by-step instructions for setting environment variables on both Windows and Linux.
🌐
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 - To edit the system variables, you’ll need an administrative command prompt. See HowTo: Open an Administrator Command Prompt in Windows to see how. Warning This method is recommended for experienced users only. The location of the user variables in the registry is: HKEY_CURRENT_USER\ Environment.
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to set environment variable in windows
How to Set Environment Variables in Windows
December 9, 2025 - In this tutorial, we will cover different ways you can set, list, and unset environment variables in Windows 11.