How to Clear Environment Variables in Windows
How to Unset Env Variable in Windows
The operating system’s environment makes use of data stored in environment variables. There is a lot of information we can learn from them about how the software works. Environment variables can be divided into two categories:
- When a program is installed, the OS or driver sets these environment variables, which include information about system resources. These are called System Environment Variables. For instance, the windir variable will hold the location of Windows.
- Information specific to a given user account is stored in User Environment Variables. Setting the PATH variable in order for the commands to run without having to provide the file path every time is an example of this.
Here’s how to clear System Env Variables using Registry Editor:
Environment Variables Window
And to clear user Env Variable, the steps are:
- Launch Control Panel and select the System symbol.
- Select the “Advanced system settings” link on the left side, and if desired, shut the System control panel window.
- Select the Env Variables icon with your mouse or tapping device.
- Press “Delete” next to the variable you wish to delete at the bottom of the System variables section.
- Once you’re finished eliminating system variables, click “OK” to confirm.
The same software used for clearing Env Variables can be used to edit or create new ones as well. However, if you’re not sure about it, it’s better to leave it to a professional. Since the variables are the backbone of your Operating System and software, messing with them can result in a system crash. This can be more expensive than asking a professional to deal with them in the first place.
- Click on the “User Accounts” button in the Control Panel.
- On the left, click or tap the “Change my environment variables” link, and if you wish, shut the User Accounts control panel window.
- Pick a variable you would like to remove outlined at the top of the User variables for <current user name> section, and press the “Delete” option.
- When you’re finished eliminating user variables from your account, select “OK” to confirm the deletion.
Power Shell
There are ways to unset both types of Env Variables. You can do so by using the Environment Variables window, Power Shell, and Registry Editor.
- Launch a Windows PowerShell session in the elevated mode.
- Paste the following command into the elevated PowerShell:
Get-ChildItem Env:
- Hit “Enter” and make a note of the name of the system variable you wish to unset.
- Enter the command below into the elevated PowerShell:
[Environment]::SetEnvironmentVariable("[variable name]",$null,"Machine")
- Substitute [variable name] with the variable name you wish to remove in the command above.
- You may now exit the elevated Windows PowerShell.
Power Shell can also be used to clear both types of Env Variables effectively. Here is how to clear System Env Variables:
- Run Windows PowerShell in elevated mode.
- In the elevated PowerShell prompt, paste the following command:
Get-ChildItem Env:
- Press “Enter.”
- Now type or paste the command below:
[Environment]::SetEnvironmentVariable("[variable name]",$null,"User")
- Hit “Enter” again and close PowerShell.
Registry Editor
Environment variables may be helpful to programmers, system administrators, and other advanced users. They provide us with details about the environment wherein an application is running. In some instances, you can delete an environment variable. In other cases, you can change only its value.
- To launch Registry Editor, press Win + R to open Run, input “
regedit
” into Run, then click on “OK.” - On the left side of Registry Editor, navigate to the key shown below.
HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerEnvironment
- Click or press and hold on the value name of the variable you wish to delete on the right side of the Environment key in Registry Editor. Then click or tap on “Delete.”
- Confirm by clicking on “Yes.”
- Close the Registry Editor.
Sometimes you might need to clear the environment variable on your Windows. But how can you do this? Keep reading to find out all the methods you can use to remove and change environment variables.
- To open Registry Editor, use Win + R to bring up Run, type “
regedit
” into Run, and then click “OK.” - In the Registry Editor’s left pane, go to the key indicated below.
HKEY CURRENT USEREnvironment
- On Registry Editor, click or press and hold the value name of the variable you intend to remove on the right side of the Environment key. After that, select “Delete.”
- Confirm your selection by selecting “Yes.”
- Ensure that the Registry Editor is closed.
Additional FAQs
Why are Env Variables important?
Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.Each Windows PC has a vast array of variables. Variables such as OS, TEMP, and PATH are often utilized. You may find default values for Windows environment variables on websites like Wikipedia.
What are the default Windows Environment Variables?
The answer to the question, “What are environment variables?” is a relatively difficult one. As you can observe from this guide, dealing with Windows programs makes it tough to locate and observe environment variables.
Have Control Over Your Env Variables
Have you ever tried to clear Env Variables? Have you tried editing or creating new ones? Did you find it difficult? Let us know in the comment section below!Their management is handled in the background by the OS and the numerous apps and drivers you run on your computer. The OS and your existing programs, on the other hand, rely on them. Your system could malfunction if you mess about with the values of critical system variables without understanding what you’re doing.
To clear the User Env Variables, follow these steps:
# Devices, PC & Mobile, Windows
BY : https://www.mathurapost.com/2022/03/15/how-to-clear-environment-variables-in-windows/
Comments
Post a Comment