Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Windows 綜合教學 >> 關於 Windows

Win8.1 批次檔一鍵清理系統垃圾:無需第三方軟體、秒級完成

編輯:關於 Windows

Windows 8.1 同樣繼承 `cleanmgr` 與批次檔清理機制。透過簡單的 `.bat` 腳本,可一鍵清除暫存檔、Prefetch、瀏覽器快取、回收站等系統垃圾,無需安裝任何第三方優化軟體,速度極快。

批次檔製作與執行

  1. 桌面右鍵 → **新增 → 文字文件** → 命名 `CleanJunk.txt`
  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%\AppData\Local\Temp\*.*
del /f /s /q "%userprofile%\AppData\Local\Microsoft\Windows\INetCache\*.*"
del /f /q %userprofile%\AppData\Local\Microsoft\Windows\History\*.*
echo 清理完成!按任意鍵結束...
pause
  1. **另存為** → 檔案類型「所有檔案」 → `CleanJunk.bat`
  2. **右鍵 → 以系統管理員身分執行** (清理系統資料夾需權限)

批次檔建立示意

記事本輸入碼

指令解析

指令清理目標說明
del *.tmp / *._mp / *.log / *.gid / *.chk / *.old系統磁碟根目錄下常見暫存副檔名/f 強制 /s 遞迴 /q 安靜模式
recycled\*.*回收站資料夾 (FAT32/舊版)NTFS 為 `$Recycle.Bin`,此行相容用
%windir%\*.bakWindows 目錄備份檔
%windir%\prefetch\*.*預先擷取快取重開機後自動重建,無副作用
rd %windir%\temp & md %windir%\temp系統暫存資料夾整個重建最徹底清理,避免權限殘留
%userprofile%\AppData\Local\Temp目前使用者暫存資料夾Win8/10/11 標準路徑
INetCache / HistoryIE/Edge Legacy 快取與歷史現代瀏覽器另清

注意事項

  • **執行前關閉所有程式**,避免檔案被鎖定刪除失敗
  • **重要檔案勿放在 C 槽根目錄/Temp/回收站**,腳本會強制刪除
  • Prefetch 清理後下次開機會稍慢 (重建中),屬正常現象
  • 現代瀏覽器 (Chrome/Edge/Firefox) 快取**不包含在內**,請用瀏覽器內建清除

進階:加入右鍵選單 (登錄表)

Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\CleanJunk]
@="一鍵清理系統垃圾"
"Icon"="cleanmgr.exe"
[HKEY_CLASSES_ROOT\Directory\Background\shell\CleanJunk\command]
@="cmd /c \"C:\\Path\\CleanJunk.bat\""

桌面空白處右鍵即可直接呼叫,無需尋找批次檔圖示。

Copyright © Windows教程網 All Rights Reserved