小明的網誌

一個工程師的故事

By

搬移 Windows 7 winsxs, 減少 SSD 使用空間

條件:

  • 主機板只有 1 顆只安裝系統的硬碟,若有多顆硬碟需拆到只剩 1 顆
  • Windows 7 光碟
  • movefile & pendmoves 檔案(檔名:PendMoves.zip),軟微官網備份

步驟

  1. 解壓縮 Pendmoves.zip,並把裡面的 2 個檔案(movefile.exe 及 pendmoves.exe)搬到 %WINDIR%\system32 之下
  2. 以系統管理員身分執行,開啟 cmd.exe
  3. 取得 winsxs 擁有者及權限,把下面指令一行一行貼進 cmd.exe 裡
sc stop msiserver
sc stop TrustedInstaller
sc config msiserver start= disabled
sc config TrustedInstaller start= disabled
 
icacls "%WINDIR%\WinSxS" /save "E:\cytseng\WinSxS.acl" /t
takeown /f "%WINDIR%\WinSxS" /r
Icacls "%WINDIR%\WinSxS" /GRANT "Administrators":(F)
  1. 建立假目錄,供 mklink 用
cd %windir%
mklink /D winsxs.link winsxs.moved
  1. 利用 movefile.exe 執行以下工作
movefile %windir%\winsxs %windir%\winsxs.moved
movefile %windir%\winsxs.link %windir%\winsxs
  1. 假設都沒有問題,直接重開機
  2. 再把 winsxs.moved 搬到其他地方(假設搬至 E:\Windows\winsxs)
robocopy %windir%\winsxs.moved E:\Windows\winsxs /E /COPYALL /SEC
  1. 重建 link
cd %windir%
rmdir winsxs
mklink /D winsxs E:\Windows\winsxs
  1. 利用 Windows 7 光碟,進 repair mode,直接把刪除 %windir%\winsxs.moved
cd c:\Windows
rmdir winsxs.moved /s /q

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步了解 Akismet 如何處理網站訪客的留言資料

Verified by MonsterInsights