windows-clean-files
1.0.2
dotnet tool install --global windows-clean-files --version 1.0.2
dotnet new tool-manifest
dotnet tool install --local windows-clean-files --version 1.0.2
#tool dotnet:?package=windows-clean-files&version=1.0.2
nuke :add-package windows-clean-files --version 1.0.2
windows-clean-files
A console UI tool (using RazorConsole) to audit and safely clean up orphaned MSI/MSP cache files ("arquivos órfãos") from C:\\Windows\\Installer on Windows.
This is a C# rewrite of the original PowerShell script arquivos.ps1, with a richer TUI dashboard instead of command-line switches.
What it does
- Scans
C:\\Windows\\Installerfor.msiand.mspfiles. - Uses the Windows registry to detect which MSI/MSP files are still referenced by installed products.
- Marks files as:
- Orphaned ("arquivos órfãos"): present on disk but not referenced in the registry.
- In use: currently locked by another process.
- Safe to remove: orphaned and not in use.
- Produces an audit report:
C:\\Temp\\Installer_Audit_<timestamp>.csvsummarizing all files and flags.C:\\Temp\\Installer_Cleanup_<timestamp>.logwith a log of the run.
- Optionally moves safe-to-remove files into a backup folder instead of deleting them:
C:\\Temp\\InstallerBackup_<timestamp>\\with all moved files.manifest.csvinside the backup with the full list of moved files.
- Shows a PowerShell command you can use later to restore those files to
C:\\Windows\\Installerif needed.
Safety model
This tool is designed to be conservative and reversible:
- It only considers
.msiand.mspfiles underC:\\Windows\\Installer. - It checks the Windows registry for references before considering a file orphaned.
- It checks whether a file is locked/in use before marking it safe.
- It never deletes files directly:
- It moves safe files to a timestamped backup directory.
- It writes a CSV manifest for rollback.
- It mimics the logic of the original
arquivos.ps1script, but runs as a console UI.
Requirements
- Windows (registry scanning is Windows-only and the paths are Windows-specific).
- .NET 10.0 SDK (as configured in
windows-clean-files.csproj). - Run the tool in a console that supports ANSI colors for the best experience.
Note: For best results, run the tool from an elevated (Administrator) PowerShell session, as cleaning
C:\\Windows\\Installermay require admin rights.
How to build and run
From the windows-clean-files project folder:
cd C:\dev\cli-dead-files\windows-clean-files\windows-clean-files
# Build
dotnet build
# Run (launches the RazorConsole UI)
dotnet run
When the app starts, you'll see a text-based dashboard called "Windows Installer Cleanup".
Using the UI
The main screen shows:
- A title banner.
- A configuration panel showing:
Caminho da pasta Installer:C:\\Windows\\InstallerPasta de saída:C:\\Temp
- Buttons:
Executar auditoriaRemover órfãos (com confirmação)Sair
Step 1: Audit
- Use the keyboard to focus the "Executar auditoria" button and press Enter.
- The tool will:
- Scan
C:\\Windows\\Installerfor.msi/.mspfiles. - Query the registry for referenced MSI/MSP paths.
- Test potential orphan files to see if they are currently in use.
- Write:
Installer_Audit_<timestamp>.csvinC:\\Temp.Installer_Cleanup_<timestamp>.loginC:\\Temp.
- Scan
- A Resumo panel appears showing:
Espaço total ocupado– total disk space used by all MSI/MSP files.Arquivos órfãos identificados– count of orphaned files.Espaço órfão– total size of orphaned files.Arquivos seguros para remover– how many files are considered safe to move.Espaço recuperável– how much disk space you can reclaim.Relatório– the path to the CSV report.
Step 2: Clean up orphaned files (optional)
After running the audit:
- If there are files marked safe to remove, focus "Remover órfãos (com confirmação)" and press Enter.
- A Confirmação panel is shown with:
- How many files will be moved.
- How much space will be freed.
- The backup folder path (e.g.
C:\\Temp\\InstallerBackup_20250101_120000).
- Choose:
- "Confirmar" to proceed, or
- "Cancelar" to go back.
- On confirmation, the tool will:
- Create the backup folder under
C:\\Temp. - Write
manifest.csvinside that folder. - Move each safe file from
C:\\Windows\\Installerinto the backup. - Log the results (success/fail counts, space freed) to the log file.
- Create the backup folder under
Rolling back (restoring moved files)
If you decide to restore the moved MSI/MSP files later:
Locate the backup folder path displayed in the UI (and in the log), e.g.:
C:\Temp\InstallerBackup_20250101_120000From an elevated PowerShell session, run:
Get-ChildItem 'C:\Temp\InstallerBackup_20250101_120000\*.msi*' | \ Move-Item -Destination 'C:\Windows\Installer' -Force
This is the same restore command that the original arquivos.ps1 script printed.
Relationship to arquivos.ps1
arquivos.ps1is kept in the repository for reference.- The C# app reimplements the same core behavior:
- Registry-based detection of referenced MSI/MSP files.
- Orphan/in-use/safe classification.
- CSV/export and logging.
- Backup + manifest + restore command.
- The main differences:
- UI: text-based RazorConsole UI instead of CLI switches.
- Execution: run via
dotnet runor the builtwindows-clean-files.exeinstead of callingarquivos.ps1.
If you already used arquivos.ps1 to remove "arquivos órfãos" (dead MSI cache files), you can now use this tool as a drop‑in replacement with a friendlier interface and the same safety guarantees.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.2 | 227 | 12/5/2025 |