條件:
- 主機板只有 1 顆只安裝系統的硬碟,若有多顆硬碟需拆到只剩 1 顆
- Windows 7 光碟
- movefile & pendmoves 檔案(檔名:PendMoves.zip),軟微官網,備份
步驟
- 解壓縮 Pendmoves.zip,並把裡面的 2 個檔案(movefile.exe 及 pendmoves.exe)搬到 %WINDIR%\system32 之下
- 以系統管理員身分執行,開啟 cmd.exe
- 取得 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) |
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)
- 建立假目錄,供 mklink 用
cd %windir%
mklink /D winsxs.link winsxs.moved |
cd %windir%
mklink /D winsxs.link winsxs.moved
- 利用 movefile.exe 執行以下工作
movefile %windir%\winsxs %windir%\winsxs.moved
movefile %windir%\winsxs.link %windir%\winsxs |
movefile %windir%\winsxs %windir%\winsxs.moved
movefile %windir%\winsxs.link %windir%\winsxs
- 假設都沒有問題,直接重開機
- 再把 winsxs.moved 搬到其他地方(假設搬至 E:\Windows\winsxs)
robocopy %windir%\winsxs.moved E:\Windows\winsxs /E /COPYALL /SEC |
robocopy %windir%\winsxs.moved E:\Windows\winsxs /E /COPYALL /SEC
- 重建 link
cd %windir%
rmdir winsxs
mklink /D winsxs E:\Windows\winsxs |
cd %windir%
rmdir winsxs
mklink /D winsxs E:\Windows\winsxs
- 利用 Windows 7 光碟,進 repair mode,直接把刪除 %windir%\winsxs.moved
cd c:\Windows
rmdir winsxs.moved /s /q |
cd c:\Windows
rmdir winsxs.moved /s /q