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

Win7 一鍵清理系統垃圾 BAT 腳本製作與使用全教學

編輯:Win7 系統應用技巧

自製 BAT 批次檔可深度清理 Windows 7 系統垃圾檔案,無需安裝第三方軟體,操作透明且可自訂清理範圍。

製作步驟

  1. 開啟「記事本」,貼入下方完整程式碼。
  2. 點選「檔案」→「另存新檔」,檔名輸入 清除系統垃圾.bat(副檔名必須為 .bat),儲存類型選「所有檔案」,建議存放桌面。
  3. 雙擊執行,依提示按任意鍵結束即可完成清理。

批次檔完整程式碼

@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

清理範圍說明

  • 系統暫存檔、記錄檔、檢查點檔、舊版本備份
  • 回收站資料、Windows 備份檔、Prefetch 預讀取資料
  • 使用者 Cookies、最近使用清單、IE 快取、使用者暫存資料夾

注意:執行前請關閉所有程式;prefetch 清理後首次開機會稍慢(需重新建立預讀取),屬正常現象。建議每月執行一次。

Copyright © Windows教程網 All Rights Reserved