System Delete Environment Variables in Windows 11


  • Staff
Environment_Variables_banner.png

This tutorial will show you how to delete user and system environment variables in Windows 10 and Windows 11.

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%" for command and "$Env:UserProfile" for PowerShell) 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 (machine) environment variables (set for all users).

User environment variables are stored in the registry key below:

HKEY_CURRENT_USER\Environment

System environment variables are stored in the registry key below:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

You can open a command prompt, type set, and press Enter to display all current environment variables on your PC.

You can open PowerShell, type Get-ChildItem Env:, and press Enter to display all current environment variables on your PC.



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




Option One

Delete User Environment Variables in Environment Variables


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)

This opens rundll32.exe sysdm.cpl,EditEnvironmentVariables.


Delete_user_environmental_variables-1.png

3 Under the top User variables for <current user name> section, select the variable (ex: "Downloads") you want to remove, and click/tap on Delete. (see screenshot below)

Delete_user_environmental_variables-2.png

4 When finished deleting user variables for your account, click/tap on OK to apply. (see screenshot below)

Delete_user_environmental_variables-3.png




Option Two

Delete User Environment Variables in PowerShell


1 Open Windows Terminal, and select Windows PowerShell.

2 Type the command below into Windows Terminal, and press Enter. (see screenshot below)

[Environment]::SetEnvironmentVariable("[variable name]",$null,"User")

Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to delete.

For example: [Environment]::SetEnvironmentVariable("Downloads",$null,"User")


3 You can now close Windows Terminal if you like.

Delete_user_environmental_variables-PowerShell.png





Option Three

Delete User Environment Variables in Registry Editor


1 Open Registry Editor (regedit.exe).

2 Navigate to the key below in the left pane of Registry Editor. (see screenshot below step 3)

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 below)

Delete_user_environmental_variables_regedit-1.png

4 Click/tap on Yes to confirm. (see screenshot below)

Delete_user_environmental_variables_regedit-2.png

5 When finished deleting user variables for your account, you can close Registry Editor if you like.




Option Four

Delete System Environment Variables in Environment Variables


You must be signed in as an administrator to use this option


1 Open Advanced System Properties (SystemPropertiesAdvanced.exe).

2 Click/tap on the Environment Variables button. (see screenshot below)

Delete_system_environmental_variables-1.png

3 Under the bottom System variables section, select the variable (ex: "Downloads") you want to remove, and click/tap on Delete. (see screenshot below)

Delete_system_environmental_variables_regedit-2.png

4 When finished deleting user variables for your account, click/tap on OK to apply. (see screenshot below)

Delete_system_environmental_variables_regedit-3.png

5 Click/tap on OK. (see screenshot below)

Delete_system_environmental_variables_regedit-4.png




Option Five

Delete System Environment Variables in PowerShell


You must be signed in as an administrator to use this option


1 Open Windows Terminal (Admin), and select Windows PowerShell.

2 Type the command below into Windows Terminal (Admin), and press Enter. (see screenshot below)

[Environment]::SetEnvironmentVariable("[variable name]",$null,"Machine")

Substitute [variable name] in the command above with the actual variable name (ex: "Downloads") you want to delete.

For example: [Environment]::SetEnvironmentVariable("Downloads",$null,"Machine")


3 You can now close Windows Terminal (Admin) if you like.

Delete_system_environmental_variables-PowerShell.png





Option Six

Delete System Environment Variables in Registry Editor


1 Open Registry Editor (regedit.exe).

2 Navigate to the key below in the left pane of Registry Editor. (see screenshot below step 3)

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 for your account, and click/tap on Delete. (see screenshot below)

Delete_system_environmental_variables_regedit-1.png

4 Click/tap on Yes to confirm. (see screenshot below)

Delete_user_environmental_variables_regedit-2.png

5 When finished deleting system variables, you can close Registry Editor if you like.


That's it,
Shawn Brink


 

Attachments

  • Environment_Variables.png
    Environment_Variables.png
    1.6 KB · Views: 7
Last edited:

My Computers

System One System Two

  • OS
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Asus TUF Gaming (2024)
    CPU
    i7 13650HX
    Memory
    16GB DDR5
    Graphics Card(s)
    GeForce RTX 4060 Mobile
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    512GB SSD internal
    37TB external
    PSU
    Li-ion
    Cooling
    2× Arc Flow Fans, 4× exhaust vents, 5× heatpipes
    Keyboard
    Logitech K800
    Mouse
    Logitech G402
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF
  • Operating System
    11 Home
    Computer type
    Laptop
    Manufacturer/Model
    Medion S15450
    CPU
    i5 1135G7
    Memory
    16GB DDR4
    Graphics card(s)
    Intel Iris Xe
    Sound Card
    Eastern Electric MiniMax DAC Supreme; Emotiva UMC-200; Astell & Kern AK240
    Monitor(s) Displays
    Sony Bravia XR-55X90J
    Screen Resolution
    3840×2160
    Hard Drives
    2TB SSD internal
    37TB external
    PSU
    Li-ion
    Mouse
    Logitech G402
    Keyboard
    Logitech K800
    Internet Speed
    20Mbit/s up, 250Mbit/s down
    Browser
    FF

Latest Support Threads

Back
Top Bottom