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

批次檔自動化:排程清理暫存檔 + 磁碟重組

編輯:系統最佳化

電腦久用必慢,主因暫存檔堆積與磁碟碎片。寫批次檔搭配工作排程器,實現全自動維護:

清理暫存檔批次(cleanup.bat)

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%\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\*.*

磁碟重組指令

以 C: 為例:defrag c: -v -f > c:\defrag.txt
-f 強制重組(空間不足也執行),-v 詳細報告,> 導向文字檔留存。

排程自動執行

  1. 控制台 → 工作排程器 → 建立基本工作。
  2. 觸發條件設定(如每天凌晨 3 點)。
  3. 動作選「啟動程式」 → 程式:cmd.exe → 引數:/c cleanup.bat && defrag c: -v -f > c:\defrag.txt。

一勞永逸,電腦永遠保持乾淨高效。

Copyright © Windows教程網 All Rights Reserved