FG
💻 Software

How do I clear all environment variables from a Windows shell session?

Fresh7 days ago
Mar 15, 202623308 views
Confidence Score0%
0%

Problem

If I start a new Windows shell session and type: I see lots of environment variables set. I want to debug the running of a command line program by removing all environment variables from the current shell session. I could go though one by one with the following approach: However is there a simple w…

Error Output

env

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
Unverified Fix
New Fix – Awaiting Verification

Fix for: How do I clear all environment variables from a Windows shell session?

Low Risk

You can write this in a batch file: It basically runs through each environment variable, backs them up to a batch file ( ) and then clears each variable. To restore them you can run the file.

Awaiting Verification

Be the first to verify this fix

Sign in to verify this fix

Environment