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

Windows Vista 系統垃圾清理批次檔:一鍵釋放磁碟空間

編輯:Win7 系統應用技巧

批次檔完整程式碼

@echo off
title Windows Vista 系統垃圾清理批次程式
color 2E
echo Windows Vista 作業系統在安裝與使用過程中會產生大量垃圾檔案,
echo 包含暫存檔、日誌檔、暫存說明檔、磁碟檢查檔、備份檔等。
echo 特別是 IE 暫存資料夾快取有時佔用數百 MB 空間。
echo 此腳本自動清理無用垃圾檔案,不觸碰重要系統檔案,請放心使用!
echo --------------------------------------------------------------------------------
echo 準備開始系統清理...
pause
cls

@echo off
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 /s /q %windir%\prefetch\*.*
rd /s /q %windir%\temp & md %windir%\temp
del /f /s /q "%appdata%\Microsoft\Windows\cookies\*.*"
del /f /s /q "%userprofile%\Local Settings\Temporary Internet Files\*.*"
del /f /s /q "%userprofile%\Local Settings\Temp\*.*"
rd /s /q "%userprofile%\Local Settings\Temp\" & md "%userprofile%\Local Settings\Temp\"
del /f /s /q "%appdata%\Microsoft\Windows\Recent\*.*"

@echo off
cls
color 2A
echo --------------------------------------------------------------------------------
echo Vista 系統垃圾清理完成
echo --------------------------------------------------------------------------------
echo 按任意鍵結束...
pause

使用說明

  1. 將上述程式碼複製至記事本,儲存為 CleanVista.bat。
  2. 以「系統管理員身分執行」(右鍵選擇)以確保清理系統級暫存目錄。
  3. 按提示操作,清理完成自動暫停顯示結果。

清理目標解析

指令清理目標環境變數說明
%systemdrive%\*.tmp系統磁碟根目錄暫存檔通常為 C:\
%windir%\prefetch\*.*預讀快取Windows\Prefetch
%windir%\temp系統暫存資料夾重建空資料夾
%appdata%\Microsoft\Windows\cookiesCookie 檔案使用者漫遊設定
%userprofile%\Local Settings\Temporary Internet FilesIE 快取佔用空間通常最大
%userprofile%\Local Settings\Temp使用者暫存資料夾重建空資料夾
%appdata%\Microsoft\Windows\Recent最近使用清單捷徑檔 (.lnk)

進階建議

  • 搭配「工作排程器」設定每週自動執行。
  • 若使用 Firefox/Chrome,可加入對應快取路徑清理指令。
  • 定期執行 cleanmgr.exe (磁碟清理工具) 清理系統更新備份、錯誤報告等批次檔未涵蓋項目。
Copyright © Windows教程網 All Rights Reserved