Professional Documents
Culture Documents
Set PATH and Other Environment Variables in Windows 10
Set PATH and Other Environment Variables in Windows 10
Set PATH and Other Environment Variables in Windows 10
com
In older windows systems you had to navigate to Advanced System Settings in Control
Panel to view, edit or add environmental variables.
In Windows 8 and 10, you can navigate to Advanced System Settings in a similar way.
Windows 8 - Right click on bottom left corner to get Power User Task Menu → Select System
→ Advanced System Settings → Environment variables → Choose New, Edit or Delete.
Windows 10 - Right click on Start Menu to get Power User Task Menu → Select System →
Advanced System Settings → Environment variables → Choose New, Edit or Delete.
However, in Windows 10 you can directly get to the Environment Variables window using
Search the web and Windows box next to the Start menu. Type environment
variables in Windows Search box which gives you two options in search results:
Choose either option and you can add, edit or delete environment variables like PATH.
Set environment variables from command prompt
You can set environment variables from Windows Command Prompt using the set or setx
command. The set command only sets the environment variable for the current session. The
setx command sets it permanently, but not for the current session. If you want to set it for
current as well as future sessions, use both setx and set.
For example, you can set the PATH environment variable permanently (current and future
sessions) as below:
C:\>set PATH=C:\myfolder;%PATH%
C:\>echo %PATH%
Note:
1. 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 Prompt(Admin).
C:\>setx /m PATH "C:\myfolder;%PATH%"
2. The maximum value allowed for a enviroment variable is 1024 characters. So if your variable is
long and you try to append to it with setx, you may get a truncated result.
C:\>setx PATH "C:\myfolder;%PATH%"
If your PATH variable is too long, then the best method would be to edit the registry.
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session
Manager\Environment
Add, Edit or Delete the environment variable you want to change, then reboot to activate the
changes.