Google Code Prettify - 輕量級的語法上色工具

星期三, 4月 15, 2020

空間不足,被用盡。速度慢

Windows 下的 TEMP 目錄中檔案過多會導致系統效能驟降

透過程式刪除那些太舊的檔案。還好 Windows Server 2003 開始,就有了 Forfiles 工具程式,可以方便我透過一行指令來刪除這些檔案。因此我寫了一個批次檔,用來刪除 7 天以前所有 sess_* 開頭的檔案,其指令如下:

forfiles /P c:\Windows\Temp /M sess_* /S /D -7 /C "cmd /c del /F @path"

一行指令,執行了約 20 個小時,才把所有檔案刪除完畢,刪除完後,網站的執行速度比搬遷前還快好幾倍,問題解決! ^__^


https://blog.miniasp.com/post/2012/12/05/Too-many-files-on-Windows-TEMP-folder-will-cause-system-petformance-down

------------------------------------------------------------------------------------------------------

C:\Windows\temp 或 C:\Windows\logs\cbs 有非常多不明 cab_xxxx 檔或 CBS.log 及其相關 log 檔異常肥大,造成C槽空間被用盡。

C:\Windows\temp 的 cab_xxxx 檔
C:\Windows\logs\cbs 的 log 檔
CbsPersist_XXXXXXXXXXXXXX.log
CbsPersist_XXXXXXXXXXXXXX.cab

解決方式
1. 如TrustedInstaller 服務執行中,需先停止 TrustedInstaller 服務(此服務預設為停用),刪除 C:\Windows\logs\cbs 內 CBS.log 和 CbsPersist_XXXXXXXXXXXXXX.log,然後 C:\Windows\temp 內所有 cab_xxxx 檔。


開啟命令提示字元視窗,分別輸入以下命令
net stop trustedinstaller
del %SystemRoot%\logs\cbs\cbs*.log /f /q
del %SystemRoot%\temp\* /f /q