Created
January 17, 2026 09:04
-
-
Save CanXploit/9e12d591ee115365b56fafb90c80d296 to your computer and use it in GitHub Desktop.
PowerShell script to clean temporary files, Prefetch, Windows Update cache, and Recycle Bin safely
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $Paths = @( | |
| "$env:LOCALAPPDATA\Temp", | |
| "$env:TEMP", | |
| "C:\Windows\Prefetch", | |
| "C:\Windows\SoftwareDistribution\Download", | |
| "C:\Windows\Temp" | |
| ) | |
| foreach ($path in $Paths) { | |
| Get-ChildItem -Path $path -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue | |
| } | |
| Clear-RecycleBin -Force -ErrorAction SilentlyContinue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment