Adding folders to the PATH in Windows 11
On Windows 11, you can add a folder to your PATH (so its programs/scripts can be run from any terminal) in a couple of ways. Here’s the step-by-step method using the GUI and the command line:
🔹 Method 1: Using System Settings (Permanent)
- Open System Properties
- Press Win + R, type
sysdm.cpl
, and press Enter. - Or: Right-click Start → System → Advanced system settings.
- Press Win + R, type
- Go to Environment Variables
- In the System Properties window, click Advanced → Environment Variables.
- Edit PATH variable
- In the Environment Variables window:
- Under User variables (affects only your account) or System variables (affects all users), find Path and select it.
- Click Edit.
- In the Environment Variables window:
- Add new folder
- Click New, paste the folder path (e.g.
C:\MyTools\bin
). - Click OK to save.
- Click New, paste the folder path (e.g.
- Restart terminal
- Close and reopen Command Prompt / PowerShell / Windows Terminal for the changes to take effect.
🔹 Method 2: Using Command Line (Temporary or Permanent)
Temporary (for current session only):
set PATH=%PATH%;C:\MyTools\bin
or in PowerShell:
$env:PATH += ";C:\MyTools\bin"
Permanent (PowerShell, applies to user):
setx PATH "$env:PATH;C:\MyTools\bin"
⚠️ setx
has a length limit (~2047 characters) and won’t expand variables like %SystemRoot%
.
✅ After doing this, you can type a program name from that folder in any terminal and it will run without needing the full path.