To set a temporary or 'per session' environment varible from a command line you can use:

set ‹var name›=‹value>

Make sure your spacing is exactly as shown above, if you add a space between the equal sign the command will fail.

Check: Link for a nice tutorial and info on environment variables.

Answer from akseli on Stack Exchange
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows-server › administration › windows-commands › set_1
set (environment variable) - Windows commands
If you use the set command without any parameters, the current environment settings are displayed. 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.
🌐
Autodesk
autodesk.com › support › technical › article › caas › sfdcarticles › sfdcarticles › How-to-set-an-environment-variable.html
How to set an environment variable
How to set an environment variable in different Operative Systems How to Set Environment Variables in macOS , Windows , and Linux. For macOS terminal based programs macOS Mojave (10.14) or earlier (bash is the default shell). Permanent environment variable in bash for the current user: Edit ...
🌐
GitHub
gist.github.com › mitchmindtree › 92c8e37fa80c8dddee5b94fc88d1288b
How to permanently set user environment variables on Windows · GitHub
Here are three ways you can set the user environment variable FOO with the value path\to\foo so that the variable persists across sessions. ... [Environment]::SetEnvironmentVariable("FOO", "path\to\foo", [System.EnvironmentVariableTarget]::User) Using the windows GUI.
Find elsewhere
🌐
MiniTool Partition Wizard
partitionwizard.com › home › news › a full guide to environment variables set and edit on windows 11
How to Set and Edit Environment Variables on Windows 11
January 16, 2026 - You need to reopen the Environment Variables window, select PATH under System variables, and restore the missing path. How to set and edit environment variables on Windows 11? This post provides 3 methods for you.
🌐
PyPI
pypi.org › project › python-dotenv
python-dotenv · PyPI
To help you with that, you can add python-dotenv to your application to make it load the configuration from a .env file when it is present (e.g. in development) while remaining configurable via the environment: from dotenv import load_dotenv load_dotenv() # reads variables from a .env file and sets them in os.environ # Code of your application, which uses environment variables (e.g.
      » pip install python-dotenv
    
Published   Mar 01, 2026
Version   1.2.2
🌐
Eleven Forum
elevenforum.com › windows support forums › tutorials
Create New Environment Variables in Windows 11 | Windows 11 Forum
November 20, 2024 - Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want used as the environment variable (ex: "%Downloads%" or "$Env:Downloads"). Substitute [variable value] in the command above with the actual variable value (ex: "C:\Users\Brink\Downloads") you want referenced by the environment variable. For example: [Environment]::SetEnvironmentVariable("Downloads","C:\Users\Brink\Downloads","User") 3 You can now close Windows Terminal if you like.
🌐
NTU Singapore
www3.ntu.edu.sg › home › ehchua › programming › howto › Environment_Variables.html
Environment Variables in Windows/macOS/Linux
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 '%').
🌐
Atlassian
imatest.atlassian.net › wiki › spaces › KB › pages › 12049809418 › Editing+System+Environment+Variables
Editing System Environment Variables - Knowledge Base - Imatest
If the property is a plain text value, type in the variable value (and name, if it is a new variable). Click OK on each of the windows to save the changes. Note, for some properties, you may need to restart your computer before the changes take effect. To permanently set an environment variable ...
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › how to set environment variable in windows
How to Set Environment Variables in Windows
December 9, 2025 - The method for checking current environment variables depends on whether you are using the Command Prompt or Windows PowerShell: In the Command Prompt, use the following command to list all environment variables: ... Both the Command Prompt and PowerShell use the echo command to list specific environment variables. ... Here, [variable_name] is the name of the environment variable you want to check. Follow the steps to set environment variables using the Windows GUI:
🌐
Microsoft Learn
learn.microsoft.com › en-us › answers › questions › 3243422 › standard-users-how-do-you-set-enviroment-variables
Standard users How Do you set Enviroment variables - Microsoft Q&A
December 28, 2019 - I've tryed to restart windows explorer or OS but with no success. It works randomly. Sometimes when I set the value through the control panel it works , sometimes it doesn't · and I always double check the folder path/name or debug it writing echo %var1% etcc... The real problem it happens randomly. I suspect it only happens with standard user account ... I made a second video: here I just open Panel ,move the %var% and close. It works ! ... Environmental variables that you set in a Command Prompt are only valid during that session.
🌐
Microsoft Learn
learn.microsoft.com › en-us › windows › win32 › api › winbase › nf-winbase-setenvironmentvariable
SetEnvironmentVariable function (winbase.h) - Win32 apps | Microsoft Learn
September 22, 2022 - BOOL SetEnvironmentVariable( [in] LPCTSTR lpName, [in, optional] LPCTSTR lpValue ); ... The name of the environment variable. The operating system creates the environment variable if it does not exist and lpValue is not NULL.
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(!).

🌐
C# Corner
c-sharpcorner.com › article › how-to-addedit-path-environment-variable-in-windows-11
How To Add/Edit Path Environment Variable In Windows 11
October 12, 2023 - We require permission from the system administrator and privileges to utilize and set the environment variables. As a result, you must notify the system administrator and request their assistance if you are not one. Step 1. Open the Setting using any of the following ways · Press Windows+R, type "sysdm.cpl" and press "Ok".
🌐
WineHQ
forum.winehq.org › home › board index › wine help › linux
How to set Windows PATH Environment Variable? - WineHQ Forums
July 27, 2013 - That page did lead me to http://wiki.winehq.org/UsefulRegistryKeys and, interestingly, the settings listed there suggest the place to set the PATH is under: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment Other pages on setting Windows environment variables via the Registry (usually programatically) also imply that this is the correct place to set PATH.