Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學

Win7 一分鐘清理系統垃圾:自製 cleanup.bat 批次檔雙擊秒清暫存檔/快取/回收筒

編輯:Windows 7 系統介紹

電腦用久變慢、C 盤紅滿?自製一鍵清理批次檔,雙擊自動清空暫存檔、瀏覽器快取、回收筒、預讀資料,一分鐘釋放數 GB 空間。

建立 cleanup.bat

  1. 桌面右鍵 →「新增」→「文字文件」→ 命名 cleanup.bat。
  2. 編輯貼上以下程式碼:
@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 清除完成!
pause
  1. 「檔案」→「另存新檔」→ 儲存類型「所有檔案」→ 桌面存檔。
  2. 日後需要清理,雙擊 cleanup.bat 即可自動執行。
另存為 bat 檔

進階:配合工作排程器設定「每日/每週」自動執行,完全免人工;或加入關機指令碼(參考 ID 78954)實現關機自動清理。

Copyright © Windows教程網 All Rights Reserved