This is a Powershell script that deletes temporary files, and LOG files from Windows.
Start Windows PowerShell, or PowerShell 7 as administrator (Of course, if you don't have administrator priviliges, you can run it without eleveted priviliges, but some features may not work), and type this, to change the Execution Policy to Bypass for the Current Session:
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process(If you want to, you can change the Execution Policy to Unrestricted, instead of Bypass) Then, navigate to that directory, where you downloaded my script. Example: If you downloaded it to your Downloads folder, then type this:
cd $env:USERPROFILE\Downloads($env:USERPROFILE is an environment variable, for your user profile, generated by Windows.) Then, type this, if you would like to run the basic DeleteTemporaryFiles script:
./DeleteTemporaryFiles5_1.ps1Or, if you would like to run the script, that doesn't delete the Windows Update Temporary Files (It's recommended to run this, if an update is downloading, or installing.):
./NoWinUpdateTempDeletion_DeleteTemporaryFiles5_1.ps1Then, answer the questions, and you're done.
- The Current User's temporary files. ($env:"USERPROFILE"\AppData\Local\Temp)
- The DefaultUser's temporary files. (C:\Users\Default\AppData\Local\Temp)
- The Operating system's global temporary files. (C:\Windows\Temp) (C:\Windows\SystemTemp)
- Prefetch (SysMain/SuperFetch) files. (C:\Windowws\Prefetch)
- Recycle bin (C:$Recycle.bin)
- DNS Cache (ipconfig /flushdns)
- Windows Update junk files (C:\Windows\SoftwareDistribution\Download) [
NoWinUpdateTempDeletion_DeleteTemporaryFiles5_1.ps1doesn't remove these files] - Delivery Optimization cache (C:\Windows\DeliveryOptimization\Cache) [
NoWinUpdateTempDeletion_DeleteTemporaryFiles5_1.ps1doesn't remove these files] - Windows Error Reporting files (C:\Windows\Minidump) ($env:"USERPROFILE"\AppData\Local\CrashDumps)
- [Optional] Old, not used Windows components from WinSxS (DISM /Online /Cleanup-Image /StartComponentCleanup /ResetBase)
- ActiveX temporary files, and Java Applet temporary files (C:\Windows\Downloaded Program Files)
- [Optional] Offile Web Pages (C:\Windows\Offline Web Pages)
- [Optional] LOG files (C:\PerfLogs) (C:\Windows\Logs) (C:\inetpub\logs\LogFiles) (C:\Windows\comsetup.log) (C:\Windows\DirectX.log) (C:\Windows\DPINST.LOG) (C:\Windows\DtcInstall.log) (C:\Windows\iis.log) (C:\Windows\PFRO.log") (C:\Windows\setupact.log) (C:\Windows\setuperr.log) (C:\Windows\WindowsUpdate.log) (C:\Windows\Panther) (C:\Windows\System32\LogFiles)
- Your old Windows installation's junk files (C:\Windows.old)
- Hibernation (powercfg.exe -h off)
- [Optional] NVIDIA cache, Logs, and temporary files (C:\ProgramData\NVIDIA Corporation\Logs) (C:\ProgramData\NVIDIA Corporation\NVBackend) (C:\ProgramData\NVIDIA Corporation\Downloader) (C:\ProgramData\NVIDIA Corporation\NV_Cache) [The script will only delete fiels from these, that are older than 15 days.]