Forum Discussion
ConstanceBrody
Dec 20, 2024Copper Contributor
Need current Win11 cleanup batch script and other
I'm looking for assistance in creating a batch script for Windows 11 that effectively cleans up unnecessary files and optimizes system performance.
Barbarank
Dec 25, 2024Iron Contributor
@echo off
title Windows 11 Cleanup Script
echo Cleaning up unnecessary files...
:: Delete temporary files
del /q /f "%temp%\*"
echo Deleted files in %temp%
:: Clean the Windows Temp folder
del /q /f "C:\Windows\Temp\*"
echo Deleted files in C:\Windows\Temp
:: Clear the Recycle Bin
echo Clearing Recycle Bin...
PowerShell.exe -NoProfile -Command "Clear-RecycleBin -Confirm:$false"
echo Recycle Bin cleared.
:: Clean Windows Update cache (optional)
echo Cleaning Windows Update cache...
net stop wuauserv
del /q /f "C:\Windows\SoftwareDistribution\Download\*"
net start wuauserv
echo Windows Update cache cleaned.
:: Run Disk Cleanup (optional additional cleanup method)
echo Running Disk Cleanup...
cleanmgr /sagerun:1
:: Defragmenting Disk drives (optional)
echo Defragmenting all drives...
defrag C: -w
echo Disk defragmentation completed.
echo Cleanup complete. Please restart your system if required.
pause
redwood
Jan 14, 2026Occasional Reader
This script does not touch the Windows Prefetch files. Nor does it touch the windows recent files and other caches.