Delete User and System Environment Variables in Windows  

    Delete User and System Environment Variables in Windows

    Delete User and System Environment Variables in Windows

    How to Delete User and System Environment Variables in Windows
    Published by Category: General Tips
    14 Mar 2020
    Designer Media Ltd

    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






    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)

    Delete User and System Environment Variables in Windows-environment_variables-1.jpg

    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.

    Delete User and System Environment Variables in Windows-delete_user_environment_variables.png






    OPTION TWO

    Delete User Environment Variables in PowerShell


    1 Open Windows PowerShell.

    2 Copy and paste the Get-ChildItem Env: command into PowerShell, press Enter, and make note of the user variable name (ex: "Downloads") you want to delete. (see screenshot below)

    Delete User and System Environment Variables in Windows-delete_user_environment_variables_powershell-1.jpg

    3 Type the command below into PowerShell, 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.

    4 You can now close Windows PowerShell if you like.

    Delete User and System Environment Variables in Windows-delete_user_environment_variables_powershell-2.png






    OPTION THREE

    Delete User Environment Variables in Registry Editor


    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

    Delete User and System Environment Variables in Windows-delete_user_environment_variables_regedit-1.jpg

    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)

    Delete User and System Environment Variables in Windows-delete_user-system_environment_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 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)

    Delete User and System Environment Variables in Windows-environment_variables-2.jpg

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

    Delete User and System Environment Variables in Windows-environment_variables-3.png

    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)

    Delete User and System Environment Variables in Windows-delete_system_environment_variables.png

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

    Delete User and System Environment Variables in Windows-environment_variables-4.png






    OPTION FIVE

    Delete System Environment Variables in PowerShell


    You must be signed in as an administrator to do this option.


    1 Open an elevated Windows PowerShell.

    2. Copy and paste the Get-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)

    Delete User and System Environment Variables in Windows-delete_system_environment_variables_powershell-1.jpg

    3 Type the command below into the elevated PowerShell, 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.

    4 You can now close the elevated Windows PowerShell if you like.

    Delete User and System Environment Variables in Windows-delete_system_environment_variables_powershell-2.png






    OPTION SIX

    Delete System Environment Variables in Registry Editor


    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

    Delete User and System Environment Variables in Windows-delete_system_environment_variables_regedit-1.jpg

    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)

    Delete User and System Environment Variables in Windows-delete_user-system_environment_variables_regedit-2.png

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


    That's it,
    Shawn






  1. Posts : 456
    Windows 10
       #1

    You can also easily delete variables from the command prompt:

    setx VariableName ""

    set VariableName=

    reg delete HKCU\Environment /v VariableName

    reg delete "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /v VariableName /f


    * set: changes made by set are only until you close the command prompt

    * setx: after deleting a variable with setx you may have to close and reopen the command prompt for changes to be noticed

    * reg delete: you have to close and open another cmd for changes to be noticed
      My Computer


  2. Posts : 68,668
    64-bit Windows 11 Pro for Workstations
    Thread Starter
       #2

    Thank you for the addition Ricardo.
      My Computers


 

Tutorial Categories

Delete User and System Environment Variables in Windows Tutorial Index Network & Sharing Instalation and Upgrade Browsers and Email General Tips Gaming Customization Apps and Features Virtualization BSOD System Security User Accounts Hardware and Drivers Updates and Activation Backup and Restore Performance and Maintenance Mixed Reality Phone


  Related Discussions
Our Sites
Site Links
About Us
Windows 10 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 10" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 04:38.
Find Us




Windows 10 Forums