Keeping your Windows PC clean and responsive is important—especially if you use it daily for development, gaming, work, or general browsing. Over time, Windows stores piles of temporary files, thumbnails, DNS entries, and other cached data that can slow down your system, eat up disk space, and sometimes cause weird system glitches.
The good news? You can delete all these caches easily using PowerShell, Windows’ powerful command-line tool. This guide walks you through the exact commands you need and explains what each one does.
🔴 Why Clear Cache in Windows?
Windows creates cache files to improve performance, but they can become harmful when:
- Apps start running slowly
- The system becomes sluggish
- Files refuse to open or load
- Disk space gets low
- Old thumbnails or corrupted temp files cause bugs
- DNS cache causes browsing issues
Clearing cache is safe and often fixes these problems.
🟦 PowerShell vs CMD — What’s the Difference?
Many online guides use CMD (Command Prompt) commands like:
del /q/f/s %TEMP%\*
But these do NOT work in PowerShell, because PowerShell uses different syntax and more powerful commands.
So here are the correct and safe PowerShell commands.
🧹 1. Clear User Temporary Files
Your user TEMP folder fills up with leftover files from installers, browsers, and apps.
Run:
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
This wipes all temporary files for the current user account.
🧹 2. Clear Windows Temp Folder
This folder stores system-wide temp files.
Remove-Item "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Make sure you open PowerShell as Administrator for this step.
🧼 3. Flush DNS Cache
If websites fail to load or you get unusual network errors, your DNS cache may be corrupt.
Clear-DnsClientCache
This resets your DNS entries and can instantly fix browsing issues.
🧹 4. Clear Windows Prefetch Cache
The Prefetch folder helps Windows launch programs faster, but it can get bloated.
Remove-Item "C:\Windows\Prefetch\*" -Recurse -Force -ErrorAction SilentlyContinue
Windows rebuilds this folder automatically.
🧹 5. Clear Thumbnail Cache
If File Explorer shows wrong or broken thumbnails, clear them using:
Remove-Item "$env:LocalAppData\Microsoft\Windows\Explorer\thumbcache_*.db" -Force -ErrorAction SilentlyContinue
Stop-Process -Name explorer -Force
Start-Process explorer
Restarting Explorer refreshes your system thumbnail cache immediately.
🧼 6. Reset Microsoft Store Cache
If the Microsoft Store won’t load or shows errors:
Start-Process "wsreset.exe"
This resets all Store-related cache data.
🟩 Combined PowerShell Script (Run All at Once)
If you want a single command set that clears everything, paste this in PowerShell:
Remove-Item "$env:TEMP\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "C:\Windows\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue
Clear-DnsClientCache
Remove-Item "C:\Windows\Prefetch\*" -Recurse -Force -ErrorAction SilentlyContinue
Remove-Item "$env:LocalAppData\Microsoft\Windows\Explorer\thumbcache_*.db" -Force -ErrorAction SilentlyContinue
Stop-Process -Name explorer -Force
Start-Process explorer
Start-Process "wsreset.exe"
Write-Host "✅ Cache cleanup complete!"
This gives your system a fresh start in under a minute.
🎯 Final Thoughts
Manually cleaning up cache can dramatically improve system responsiveness, free up disk space, and solve minor Windows problems. PowerShell is the most reliable tool for this because it gives full control and avoids errors that CMD-based methods often cause.
Run this cleanup once a month—or any time your PC starts feeling slow—and enjoy a cleaner, faster Windows experience.
Top comments (0)