How to Delete User and System Environment Variables in Windows
Environment variables are a set of dynamic named values that can affect the way running processes will behave on a computer. The variables can be used both in scripts and on the command line. Environment variables makes it easy when certain standard directories and parameters need to be referenced but where the actual locations or names can vary from computer to computer.
The variable (ex: "%UserProfile%") is used as a type of shortcut of the value (ex: "C:\Users\<username>").
There are two types of environment variables: user environment variables (set only for current user) and system environment variables (set for all users).
This tutorial will show you how to delete user and system environment variables in Windows 7, Windows 8, and Windows 10.
Contents
- Option One: Delete User Environment Variables in Environment Variables
- Option Two: Delete User Environment Variables in PowerShell
- Option Three: Delete User Environment Variables in Registry Editor
- Option Four: Delete System Environment Variables in Environment Variables
- Option Five: Delete System Environment Variables in PowerShell
- Option Six: Delete System Environment Variables in Registry Editor
1 Open the Control Panel (icons view), and click/tap on the User Accounts icon.
2 Click/tap on the Change my environment variables link on the left side, and close the User Accounts control panel window if you like. (see screenshot below)
3 Select a variable you want to delete listed in the top User variables for <current user name> section, and click/tap on the Delete button. (see screenshot below)
4 When finished deleting user variables for your account, click/tap on OK to apply.
1 Open Windows PowerShell.
2 Copy and paste theGet-ChildItem Env:
command into PowerShell, press Enter, and make note of the user variable name (ex: "Downloads") you want to delete. (see screenshot below)
3 Type the command below into PowerShell, and press Enter. (see screenshot below)4 You can now close Windows PowerShell if you like.
[Environment]::SetEnvironmentVariable("[variable name]",$null,"User")
Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to delete.
1 Press Win + R keys to open Run, type regedit into Run, and click/tap on OK to open Registry Editor.
2 Navigate to the key below in the left pane of Registry Editor. (see screenshot below)
HKEY_CURRENT_USER\Environment
3 In the right pane of the Environment key in Registry Editor, right click or press and hold on the value name (ex: "Downloads") of the variable you want to delete for your account, and click/tap on Delete. (see screenshot above)
4 Click/tap on Yes to confirm. (see screenshot below)
5 When finished deleting user variables for your account, you can close Registry Editor if you like.
You must be signed in as an administrator to do this option.
1 Open the Control Panel (icons view), and click/tap on the System icon.
2 Click/tap on the Advanced system settings link on the left side, and close the System control panel window if you like. (see screenshot below)
3 Click/tap on the Environment Variables button. (see screenshot below)
4 Select a variable you want to delete listed in the bottom System variables section, and click/tap on the Delete button. When finished deleting system variables, click/tap on OK to apply. (see screenshot below)
5 Click/tap on OK. (see screenshot below)
You must be signed in as an administrator to do this option.
1 Open an elevated Windows PowerShell.
2. Copy and paste theGet-ChildItem Env:
command into the elevated PowerShell, press Enter, and make note of the system variable name (ex: "Downloads") you want to delete. (see screenshot below)
3 Type the command below into the elevated PowerShell, and press Enter. (see screenshot below)4 You can now close the elevated Windows PowerShell if you like.
[Environment]::SetEnvironmentVariable("[variable name]",$null,"Machine")
Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to delete.
You must be signed in as an administrator to do this option.
1 Press Win + R keys to open Run, type regedit into Run, and click/tap on OK to open Registry Editor.
2 Navigate to the key below in the left pane of Registry Editor. (see screenshot below)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
3 In the right pane of the Environment key in Registry Editor, right click or press and hold on the value name (ex: "Downloads") of the variable you want to delete, and click/tap on Delete. (see screenshot above)
4 Click/tap on Yes to confirm. (see screenshot below)
5 When finished deleting system variables, you can close Registry Editor if you like.
That's it,
Shawn
Related Tutorials
- Complete List of Environment Variables in Windows 10
- How to Create Environment Variables Shortcut in Windows
- How to Set New User and System Environment Variables in Windows
- How to Edit User and System Environment Variables in Windows
- How to Add Environment Variables Context Menu in Windows 10