Windows XP 運行一段時間後,臨時檔、安裝殘留、日誌、Prefetch 快取、回收站殘骸、Cookies、瀏覽歷史等「垃圾」會佔據大量磁碟空間並拖慢檔案系統存取速度。雖然有現成清理工具,但自己寫一支批次檔(.bat)不僅零成本、無廣告,還能精準控制清理範圍,隨時雙擊即用。
CleanXP.bat(副檔名務必為 .bat)@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 %windir%\*.bak
del /f /q %systemdrive%\recycled\*.*
del /f /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
rd /s /q %temp% & md %temp%
del /f /q %userprofile%\cookies\*.*
del /f /q %userprofile%\recent\*.*
rd /s /q "%userprofile%\Local Settings\Temporary Internet Files"
cls
echo 系統垃圾清除完成 :)
echo.
pause
| 參數 | 用途 |
|---|---|
/f | 強制刪除唯讀檔案 |
/s | 遞迴處理所有子目錄 |
/q | 安靜模式,不逐一確認 |
%systemdrive% | 系統磁碟代號(通常 C:) |
%windir% | Windows 目錄路徑 |
%userprofile% | 目前使用者設定檔路徑 |
rd /s /q | 刪除整個目錄樹(含子目錄) |
md | 重建空目錄,避免程式找不到路徑報錯 |
*.tmp / *._mp / *.log / *.gid / *.chk / *.old:各類暫存、備份、索引殘檔%windir%\*.bak:系統目錄下的備份檔%systemdrive%\recycled\*.*:回收站實際儲存資料夾%windir%\prefetch\*.*:預讀快取,清理後下次開機會自動重建優化版%windir%\temp / %temp%:系統與使用者臨時資料夾,清空後重建Cookies / Recent / Temporary Internet Files:IE 瀏覽痕跡與捷徑紀錄del /f /s /q "%appdata%\Adobe\*.tmp"%systemdrive% 通配符掃描非系統槽>>"%systemdrive%\CleanLog.txt" echo %date% %time% 清理完成%localappdata%\Temp),建議另寫版本一支 2KB 的批次檔,就能替你省下幾 GB 空間、換來明顯的開機加速與操作順暢度。把 CleanXP.bat 丟進桌面或快速啟動列,養成「覺得卡就點一下」的習慣,讓老舊 XP 也能輕裝上陣、戰力全開!