Have you ever wondered how programs on your Windows computer know where to find needed files or configuration settings? How does the same PATH variable work across Command Prompt, Powershell, and GUI apps? The answer is environment variables.
As your digital friend, let me walk you through how these useful variables work and importantly, how you can view, edit and create your own environment variables to unlock customization options.
What Exactly are Environment Variables?
Think of environment variables as named values that any running application can access to determine system paths, settings, hardware data and other useful details.
Rather than hard coding this info, Windows stores them centrally as variables. Some common examples include:
- %ProgramFiles% – Path to where 64-bit apps install
- %Path% – Directories searched for executables
- %Processor_Architecture% – Whether x86 or x64 CPU
According to 2022 Kinsta developer survey, over 72% of web developers rely on environment variables during work. They are ubiquitous across programming, DevOps and IT administration.
But you don‘t need to be a developer to benefit. Understanding environment variables will allow you to better optimize and control your PC.
GUI vs Command Variables: Key Differences
While conceptually they work the same, there are some key differences in managing variables via GUI vs the command line:
| Feature | GUI Methods | Command Methods |
|---|---|---|
| Scope | Sets computer-wide variables | Can isolate variables to session |
| Changes | Always system-permanent | Support session-only variables |
| Permission | Edit protected system variables | Bypass system variable locks |
| Complexity | User-friendly simplicity | Power but steeper learning curve |
For most users, GUI tools offer an easy way to view and configure the main system variables.
But for advanced cases like scripting installs or temporary testing, command line methods provide finer control to create variables visible only to that session or user.
Now let‘s explore how you can start managing variables across both GUI and command tools…
Viewing Your Environment Variables
Thanks to Windows‘ consistency, the steps to view environment variables are virtually identical from Windows 8 to Windows 11.
Via GUI:
- Right-click Start Menu > System > Advanced System Settings
- Go to Advanced tab > Environment Variables

Here Windows neatly organizes variables into distinct sections – User vs System:
- User – Specific to your account like app settings
- System – Machine-wide values like Windows folder
Via Command Prompt:
Fire up CMD or Windows Terminal then simply run:
set
You‘ll now see all your User variables print out for the current session:

Use SET ALLUSERSPROFILE to also display System variables.
Via PowerShell:
PowerShell keeps variables in the Env: drive. List them with:
Get-ChildItem Env:
The $env hash table also provides direct access to read/write variables.
As we‘ll see next – PowerShell offers the most control in modifying variables on the fly.
Creating and Changing Variables
When it comes to creating your own environment variables, you have a few options:
- Use the GUI to append new User or System variables
- Employ Command Prompt‘s setx command
- Utilize PowerShell‘s $env hash table
Let‘s walk through hands-on examples of each…
New Variable via GUI
- Under User or System variables, click New
- Set name as MY_VARIABLE and value as C:\My-Folder
- Click OK to finish!
This GUI method offers an easy way to persist variables at both the User or global System levels.
New Variable via Command Prompt
CMD offers a dedicated command for updating environment variables – setx.
Let‘s add a test variable for the current CMD session:
setx MY_TEST_VAR "Hello world"
We can print it with echo:
echo %MY_TEST_VAR%
Hello world
Unlike the GUI approach, variables via setx are by default only visible to the current shell rather than being globally scoped.
New Variable in PowerShell
Thanks to its programming language heritage, PowerShell enables fine-grained control for creating and testing variables via the $env hash table.
For example, to define a new one:
$env:TEST_VAR = "PowerShell"
We can also append variables:
$env:PATH += ";C:\New\Test\Bin;"
The $env namespace isolates changes from the main Windows environment.
This offers a safe sandbox to test configurations before committing them system-wide via cmdlets like SetEnvironmentVariable.
So in summary:
- GUI – Simple permanent User/System variable creation
- Command Prompt – Temporary session-only variables
- PowerShell – Advanced environment control and testing
Whichever method you use, unlocking the power of environment variables will open up new ways to customize your Windows experience.
Now go forth and let your variable adventure begin! I‘m excited to hear if you have any other tips or tricks to share down the road.