
Windows 7 用一段時間後,會莫名被吃掉一堆空間~ 有很多不需要的東西可以砍掉~ 或是把它壓縮起來~
以下就來處理一個巨肥的目錄 winsxs
移除 Win7 的 Service pack 備份檔 (並非移除 Service pack)
用 [系統管理者權限] 開啟 cmd.exe 並執行
dism /online /cleanup-image /spsuperseded
這樣就完成了~ 很簡單吧!~
壓縮 winsxs 目錄
移除 Service pack 備份檔後,C:\Windows\winsis 還是很大 (我的有 14.xGB)
想刪掉又怕怕的!~ 所以把它壓縮起來吧!
a. 用 [系統管理者權限] 開啟 cmd.exe
b. 停用 Windows Installer 跟 Windows Module Installer 服務
sc stop msiserver sc stop TrustedInstaller sc config msiserver start= disabled sc config TrustedInstaller start= disabled
c. 備份 winsxs 的 ACLs
icacls "%WINDIR%\WinSxS" /save "%WINDIR%\WinSxS.acl" /t
d. 取得 winsxs 與其子目錄的擁有權
takeown /f "%WINDIR%\WinSxS" /r
e. 取得 winsxs 與其子目錄的完整控制權
icacls "%WINDIR%\WinSxS" /grant "%USERDOMAIN%\%USERNAME%":(F) /t
f. 壓縮它!
compact /s:"%WINDIR%\WinSxS" /c /a /i *
這樣可以省掉不少空間!
懶得打那麼多指令的,也有懶人包~ 請以系統管理者權限執行喔!
如果想要還原,可以照以下的動作執行
a. 還原擁有權
icacls "%WINDIR%\WinSxS" /setowner "NT SERVICE\TrustedInstaller" /t
b. 還原 ACL
icacls "%WINDIR%" /restore "%WINDIR%\WinSxS.acl"
c. 還原服務狀態
sc config msiserver start= demand sc config TrustedInstaller start= demand
如果覺得還不夠,還可以再刪除這個目錄
C:\Windows\SoftwareDistribution
只是要先將下面三個服務都先停掉再刪除
Background Intelligent Transfer Service Cryptographic Services Windows Update
刪除後記得重新啟動即可