EnvCleaner is a desktop application for Windows. It manages User and System environment variables. The application scans path lists, pinpoints non-existent directories, removes duplicate entries, stages in-editor cleanups, and backs up registry values.
- Dead Path Detection: Automatically flags non-existent directories and files in
PATHand other list variables. - Duplicate Removal: Detects duplicate entries using case-insensitive and trailing-slash normalization.
- Dynamic Variable Resolution: Resolves expressions like
%USERPROFILE%and%SystemRoot%before testing disk existence. - In-Editor Staged Cleaning: Remove dead paths or duplicates directly in the Path table. Review the remaining entries before saving to the registry.
- Global Quick Clean: Scan all variables across User and System scopes at once. Review proposed removals in an interactive checklist modal before applying.
- Ordered Path Editor: Reorder path segments with dedicated Move Up and Move Down controls.
- Automatic Backups: Generates timestamped JSON and native Windows
.regsnapshots before any write operation. - Point-and-Click Rollback: Restore previous environment configurations directly from the snapshot manager.
- Registry Integration: Edits User (
HKCU) and System (HKLM) registry entries directly. - Live System Broadcast: Dispatches
WM_SETTINGCHANGEso running shells pick up changes immediately without rebooting. - Administrator Elevation: Detects standard permissions and provides a one-click restart for administrator rights.
- Theme Support: Includes both dark and light modes matching Windows 11 Fluent style.
No Python installation is required.
- Download
EnvCleaner.exeorEnvCleaner-v1.0.0-windows-x64.zipfrom GitHub Releases. - Run
EnvCleaner.exe. - To edit System environment variables (
HKLM), right-clickEnvCleaner.exeand select Run as administrator, or click Restart as Administrator inside the application header.
- Operating System: Windows 10 or Windows 11.
- Python: Python 3.10 or newer (tested on Python 3.14).
- Clone the repository:
git clone https://github.com/FunToHard/EnvCleaner.git cd EnvCleaner - Install dependencies:
pip install -r requirements.txt
- Standard User:
Or using Python:
run.bat
python -m envcleaner
- Administrator Elevation:
Or click Restart as Administrator inside the application header.
run.bat --admin
--light: Start the application in light mode.-v,--version: Display the application version.
EnvCleaner loads environment variables from two Windows Registry locations:
- User Scope:
HKEY_CURRENT_USER\Environment - System Scope:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
The scanner parses delimited strings into distinct path entries, resolves dynamic %...% expressions, and checks each path on disk using os.path.exists().
- Valid (Green): The directory or file exists on disk.
- Missing (Red): The target path does not exist on disk.
- Duplicate (Amber): The path already appeared earlier in the list.
- Syntax Error (Violet): The path contains illegal characters (
< > " | ? *) or extra colons. - Empty (Gray): A redundant semicolon created an empty entry segment.
- In-Editor Staged Cleanup: Inside the Path Inspector, clicking Remove Missing or Remove Duplicates removes invalid rows directly from the active table in place. The live character length updates immediately. Click Save Changes to Registry to commit, or Discard Changes to revert.
- Global Quick Clean: Clicking Quick Clean Issues... in the top status bar collects all issues across all variables. It opens an interactive checklist modal allowing you to select or deselect specific removals before applying.
Before applying any change or deletion to the registry, EnvCleaner automatically saves:
- A full JSON snapshot to
%USERPROFILE%\.envcleaner\backups\. - A standard
.regfile importable directly in Windows Registry Editor.
Use the Backups & Snapshots dialog to view history, export .reg files, or restore previous configurations at any time.
Run the complete test suite:
python -m unittest discover -s tests -p "test_*.py" -vAll 24 automated unit and UI tests run headlessly using Qt offscreen mode (QT_QPA_PLATFORM=offscreen).
You can compile EnvCleaner into a standalone Windows executable (EnvCleaner.exe):
Run the build script:
build.batOr with Python:
python build.pyThe build script runs all 24 automated tests, invokes PyInstaller, and produces:
dist/EnvCleaner.exe: Standalone single-file Windows executable.dist/EnvCleaner-v1.0.0-windows-x64.zip: Release archive containing the executable,README.md, andLICENSE.
The repository includes a GitHub Actions workflow in .github/workflows/release.yml. Pushing a version tag triggers automated testing, compilation on a Windows runner, and publication of release assets to GitHub Releases:
git tag v1.0.0
git push origin v1.0.0This project is licensed under the MIT License.