If you want a safe batch file to clean Windows without causing damage, you can use the script below. This script deletes unnecessary temporary files, clears caches, and cleans up Windows Update files.
Batch Script for Cleaning Windows System:
@echo off
echo Cleaning Windows System...
timeout /t 3
:: Run as administrator check
NET SESSION >nul 2>&1
IF %ERRORLEVEL% NEQ 0 (
echo Please run this script as Administrator!
pause
exit
)
:: Deleting temporary files for current user
echo Cleaning user temp files...
del /s /f /q "%USERPROFILE%\AppData\Local\Temp\*.*"
rd /s /q "%USERPROFILE%\AppData\Local\Temp"
:: Cleaning system temp files
echo Cleaning Windows temp files...
del /s /f /q "C:\Windows\Temp\*.*"
rd /s /q "C:\Windows\Temp"
:: Clearing Windows Update cache
echo Cleaning Windows Update cache...
net stop wuauserv
del /s /f /q "C:\Windows\SoftwareDistribution\Download\*.*"
rd /s /q "C:\Windows\SoftwareDistribution\Download"
net start wuauserv
:: Cleaning prefetch files
echo Cleaning Prefetch files...
del /s /f /q "C:\Windows\Prefetch\*.*"
:: Clearing DNS cache
echo Clearing DNS cache...
ipconfig /flushdns
:: Cleaning system logs
echo Cleaning event logs...
wevtutil cl Application
wevtutil cl System
wevtutil cl Security
:: Emptying Recycle Bin
echo Emptying Recycle Bin...
PowerShell.exe -NoProfile -Command "Clear-RecycleBin -Confirm:$false"
echo Cleanup Completed Successfully!
pause
What This Script Does:
✅ Deletes user and system temporary files.
✅ Clears Windows Update cache.
✅ Cleans Prefetch files (Windows stores frequently used files there).
✅ Flushes DNS cache to improve network performance.
✅ Clears system event logs.
✅ Empties the Recycle Bin.
How to Use:
1. Save this script as cleanup.bat.
2. Right-click the file and select Run as Administrator.
This will safely free up space without harming your Windows system.
ليست هناك تعليقات:
إرسال تعليق