長期使用電腦產生大量暫存檔、日誌、錯誤報告、預讀取快取等系統垃圾,拖慢效能。自製一支批次檔(.bat),雙擊即可全自動清理,省時省力。
清除系統垃圾.txt。@echo off
echo 正在清除系統垃圾檔案,請稍候......
del /f /s /q %systemdrive%\*.tmp
del /f /s /q %systemdrive%\*._mp
del /f /s /q %systemdrive%\*.log
del /f /s /q %systemdrive%\*.gid
del /f /s /q %systemdrive%\*.chk
del /f /s /q %systemdrive%\*.old
del /f /s /q %systemdrive%\recycled\*.*
del /f /s /q %windir%\*.bak
del /f /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
del /f /s /q "%userprofile%\recent\*.*"
echo 清除系統垃圾完成!
echo. & pause
清除系統垃圾.bat → 存檔類型選「所有檔案」 → 存檔。
以後每次想清理系統垃圾,直接雙擊桌面 清除系統垃圾.bat,視窗顯示執行進度,完成後按任意鍵關閉。建議以「系統管理員身分執行」以清除受保護目錄檔案。
腳本僅刪除常見暫存/垃圾檔案,不動使用者文件。若需更深度清理(Windows Update 快取、元件存放區 WinSxS 等),請使用「磁碟清理」→「清理系統檔案」或 DISM 指令。