Project index
ToolpublicWindows Administration & Endpoint Hygiene

Automated Windows temporary cache & prefetch cleaning utility

WinTempCleaner

WinTempCleaner is a lightweight Windows batch script and endpoint maintenance tool engineered to automate the removal of lingering temporary and cached files across critical operating system directories (%TEMP%, %WINDIR%\Temp, %USERPROFILE%\AppData\Local\Temp, and C:\WINDOWS\Prefetch). Developed alongside security research into malware staging tactics (detailed in the analysis article 'Why Attackers Like the Temp Folder'), WinTempCleaner enforces safe execution: preserving directory tree hierarchies, forcing read-only file removal, suppressing non-critical error noise, and providing real-time visual console feedback while preventing unauthorized background executions through interactive confirmations.

WinTempCleaner Command Prompt console showing interactive confirmation prompt and successful deletion of temporary files.

Problem

Windows default temp locations accumulate gigabytes of orphan caches and unmonitored staging artifacts that reduce storage, degrade system responsiveness, and create opportunistic staging grounds for persistence scripts.

Solution

A battle-tested Windows batch utility with interactive Y/n confirmation safeguards, recursive read-only file deletion, silent handle lock handling, and administrative permission elevation handling.

Outcome

A streamlined system utility and security research companion demonstrating Windows environment variable targeting, batch scripting automation, and disk hygiene maintenance.

Standout Features

  • Comprehensive cleanup across %TEMP%, %WINDIR%\Temp, AppData\Local\Temp, and Prefetch
  • Interactive safety confirmation preventing accidental deletions and unintended runs
  • Non-destructive execution that purges unneeded files while preserving folder hierarchy
  • Accompanied by security research analysis: 'Why Attackers Like the Temp Folder'

Stack & Signals

  • Windows Batch / CMD
  • Windows CLI
  • Prefetch Engine
  • Shell Scripting
  • GitHub Actions

Canonical destination

github.com/SagarBiswas-MultiHAT/WinTempCleaner

View on GitHub