Why Does Windows Accumulate Tens of Gigabytes in Temp Folders?
Over weeks and months of routine computer use, Windows silently hordes huge quantities of temporary files across several distinct locations. Every time an application runs, unzips an update, or extracts an installer, it stages files in your temporary directories. While software is supposed to delete these staging files upon closing, poorly written installers, system crashes, and hard shutdowns frequently leave orphan files behind forever.
The 5 Major Junk Repositories on Windows:
- User Temp (
%LOCALAPPDATA%\Temp): The primary location for browser caches, electron app caches, and unzipped software installation packages. Often exceeds 10–25 GB. - Windows System Temp (
C:\Windows\Temp): Background system services and Windows components store driver update fragments and background installation logs here. - Windows Update Download Cache (
C:\Windows\SoftwareDistribution\Download): Stored installation payloads from past Windows Updates. Even after updates install successfully, Windows rarely purges this directory. - Crash Dumps (
%LOCALAPPDATA%\CrashDumpsandC:\Windows\Minidump): When an app or game crashes, Windows takes a full memory snapshot (.DMP) which can take up 500 MB to 2 GB per crash. - Prefetch Cache (
C:\Windows\Prefetch): Startup trace logs. Over time, traces from deleted and uninstalled software clutter this folder.
Method 1: Clean Temp Files Manually via Command Prompt (CMD)
If you prefer using native command-line scripts without downloading third-party tools, you can purge both user and system temp folders with elevated administrator permissions.
Step 1: Open Elevated Command Prompt
Press Win + S, type cmd, right-click Command Prompt, and select Run as Administrator.
Step 2: Purge User Temp Files
Run the following command to recursively force-delete files and empty subdirectories:
del /q /f /s "%TEMP%\*"
for /d %p in ("%TEMP%\*") do rmdir /s /q "%p"
Step 3: Purge System Temp Files
Next, clean the Windows root temp folder:
del /q /f /s "C:\Windows\Temp\*"
for /d %p in ("C:\Windows\Temp\*") do rmdir /s /q "%p"
Step 4: Purge Windows Update Cache
To safely delete the SoftwareDistribution download cache, you must temporarily stop the Windows Update service:
net stop wuauserv
del /q /f /s "C:\Windows\SoftwareDistribution\Download\*"
net start wuauserv
Why Manual Deletion Causes "File In Use" Errors
When you attempt to select all files and press delete inside %TEMP%, Windows almost always interrupts the process with an annoying modal dialog:
"The action can't be completed because the file is open in another program."
This happens because active background services (like Google Chrome, Microsoft Edge, Slack, or antivirus scanners) maintain an active Win32 file lock on their current session temporary database. If you force-close these programs without saving, you risk losing unsaved data.
Method 2: Clean Temp Files Using Windows Storage Sense
Windows 11 includes an automated cleanup feature called Storage Sense:
- Open Settings (Win + I).
- Navigate to System > Storage.
- Click on Temporary files. Windows will calculate the size of Downloads, Delivery Optimization, and Recycle Bin.
- Check the categories you want to purge and click Remove files.
Note: Storage Sense often misses deep crash dumps, WER telemetry queues, and Windows Update payload remnants. For a deep, byte-precise purge, a dedicated portable tool is recommended.
Summary Checklist for Maximum Storage Health
- Purge
%TEMP%andC:\Windows\Temponce a month. - Clear
C:\Windows\SoftwareDistribution\Downloadafter every major Patch Tuesday update. - Delete historical crash dumps (.DMP) to prevent memory leak clutter.
- Never install bloated background cleaners that inject persistent startup telemetry.