Tired of typing C:\Users\yourname\Documents\Projects\ClientX\Archive\2026 every time you need that folder? Create your own Windows environment variable, a named shortcut like the built-in %APPDATA% and %TEMP%, and the GUI method below takes about two minutes.
What Are Environment Variables?
Type %APPDATA% in the Run dialog (Windows + R) and press Enter. Explorer opens straight to C:\Users\yourname\AppData\Roaming without you knowing the exact path. That’s a variable doing its job. Windows substitutes the stored value wherever you drop the name between percent signs.
Two scopes matter:
- User variables, visible to your account only; no admin rights required.
- System variables, visible to every account on the machine; require admin rights.
For personal shortcuts, user variables are the right starting point.
Create a Variable via the GUI (Windows 11)
- Press
Windows + Ito open Settings. - Go to System > About.
- On the right side, click Advanced system settings.
- In System Properties, stay on the Advanced tab and click Environment Variables.
- The Environment Variables window has two panels: User variables for [username] on top, System variables below.
- Click New under User variables.
- In Variable name, type a short, no-space identifier, for example,
NOTES. - In Variable value, type the target path, for example,
C:\Users\yourname\Documents\Notes. On current Windows 11 builds, Browse Directory and Browse File buttons let you pick a location without typing it out.
- Click OK, then OK again in the Environment Variables window to apply.
To test it, press Windows + R, type %NOTES%, and press Enter. Explorer should open straight to that folder.
Create a Variable via the GUI (Windows 10)
The dialog is identical; only the entry point differs.
- Press
Windows + R, typesysdm.cpl, and press Enter. - In System Properties, click the Advanced tab, then Environment Variables.
- Follow steps 5–9 from the Windows 11 method above.
Alternatively, right-click Start > System > Advanced system settings to reach the same place.
Create a Variable via Command Prompt
Temporary (current session only)
A temporary variable lives only for the life of that CMD window:
set MY_VAR=C:\Tools\MyApp
echo %MY_VAR%
Close the window and it’s gone. Use this for quick testing.
Persistent with setx
setx writes the variable to the registry so it survives reboots.
User variable:
setx MY_VAR "C:\Tools\MyApp"
System-wide (run CMD as Administrator):
setx MY_VAR "C:\Tools\MyApp" /M
setx doesn’t update the current CMD session. Open a new window to confirm the variable exists. One firm warning: never run setx PATH "..." without including the full existing PATH string. setx overwrites rather than appends. Run echo %PATH% first, save the output to a text file on a USB flash drive, and keep that backup before you touch PATH.
Create a Variable via PowerShell
PowerShell reads variables differently from CMD. Use $Env:MY_VAR, not %MY_VAR%. Mixing the two is the most common reason a variable looks broken when it’s actually fine.
Temporary (current session)
$Env:MY_VAR = "C:\Tools\MyApp"
Write-Output $Env:MY_VAR
Gone when the session closes. Same behavior as set in CMD.
Persistent via the .NET API
# User variable
[Environment]::SetEnvironmentVariable("MY_VAR", "C:\Tools\MyApp", "User")
# System-wide (run PowerShell as Administrator)
[Environment]::SetEnvironmentVariable("MY_VAR", "C:\Tools\MyApp", "Machine")
The third argument takes "User", "Machine", or "Process". "Machine" is system-wide and requires admin rights. This method is reliable for provisioning scripts. If you’re configuring a new laptop or setting variables across a fleet of machines, it’s more dependable than setx.
Create a Variable via PowerToys (Windows 11)
Microsoft PowerToys includes a modern environment variables editor. If you’re managing a long PATH or frequently adding SDK directories, the PowerToys interface is cleaner and less likely to cause accidental overwrites than the classic dialog.
- Open PowerToys.
- In the left sidebar, click Environment Variables.
- If the toggle is off, click Enable Environment Variables.
- Click Launch Environment Variables.
- Under Default variables, choose User or System to view existing entries.
- Click Add variable, enter a name and value, then save.
PowerToys uses the same underlying registry mechanism as the classic dialog. The variable is immediately visible to any app that reads environment variables on startup.
Troubleshooting
The app doesn’t see the new variable
Apps read environment variables once at startup. Close and reopen the app. If it still shows the old value, sign out of Windows and sign back in.
Variables keep disappearing
You probably used set instead of setx, the GUI, or [Environment]::SetEnvironmentVariable. The set command creates session-only variables by design.
Variable “not working” in PowerShell
CMD and Explorer use %MY_VAR%. PowerShell uses $Env:MY_VAR. If you’re in the wrong shell with the wrong syntax, the variable looks broken even when it’s set correctly.
PATH edits breaking tools
Use the list-style PATH editor: select Path under User variables > Edit > New to add each directory as a separate entry. Avoid editing PATH as a raw semicolon-delimited string; one typo can knock out every tool that depends on it. If you’re stuck after a bad edit, restore from the backup you saved to an external drive before touching it. (You did make one, right?)
User vs. system variable confusion
If a variable works in your own account but not in another user’s session, or in a service or scheduled task that runs under a different account, it’s a user variable. (An elevated prompt you open from your own account still sees your user variables.) Re-create it under System variables with admin rights to make it machine-wide.
Conclusion
The GUI method clears this up for most people and takes about two minutes, so try it first. If you’re writing setup scripts or provisioning multiple machines, [Environment]::SetEnvironmentVariable in PowerShell is more reliable than setx. And if PATH management has been the real frustration all along, PowerToys is worth installing for that list view alone; spotting duplicate or broken entries there is far easier than squinting at the classic dialog.