標籤:
詳見http://blogs.msdn.com/b/heaths/archive/2014/02/11/how-to-relocate-the-package-cache.aspx
(注意:若Windows自動更新之後導致Windows installer檔案路徑找不到,可以在磁碟管理中,重新把installer的虛擬盤映射到C:\Windows installer)
在CMD開啟diskpart工具
diskpart
建立一個最大為16G空間的虛擬磁碟
create vdisk file="E:\VHD\Cache.vhd" type=expandable maximum=16384
串連並建立分區
select vdisk file="E:\VHD\Cache.vhd"
attach vdisk
create partition primary
格式化分區,卷名Package Cache,盤符P
format fs=ntfs label="Package Cache" quick
assign letter=P
exit
拷貝Package Cache到剛建立的虛擬磁碟P中
robocopy "%ProgramData%\Package Cache" P:\ /e /copyall /move /zb
...等待.....
mkdir "%ProgramData%\Package Cache"
echo y | cacls foo /s:"O:BAG:DUD:PAI(A;OICIID;FA;;;BA)(A;OICIID;FA;;;SY)(A;OICIID;FRFX;;;BU)(A;OICIID;FRFX;;;WD)"
查看P盤的GUID
mountvol
並將Package Cache目錄指向
mountvol "%ProgramData%\Package Cache" \\?\Volume{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\
卸載盤符P
diskpart
select vdisk file="E:\VHD\Cache.vhd"
select partition 1
remove letter=P
exit
開機自動掛載虛擬磁碟,並刪除盤符
echo select vdisk file=E:\VHD\Cache.vhd > E:\VHD\Cache.txt
echo attach vdisk >> E:\VHD\Cache.txt
schtasks /create /ru system /sc onstart /rl highest /tn "Attach Package Cache" /tr "%SystemRoot%\System32\diskpart.exe /s E:\VHD\Cache.txt"
同以此方法,建立C:\Windows\Installer的虛擬磁碟
在CMD開啟diskpart工具
diskpart
建立一個最大為16G空間的虛擬磁碟
create vdisk file="E:\VHD\Installer.vhd" type=expandable maximum=16384
串連並建立分區
select vdisk file="E:\VHD\Installer.vhd"
attach vdisk
create partition primary
格式化分區,卷名Package Cache,盤符Q
format fs=ntfs label="Installer" quick
assign letter=Q
exit
拷貝Package Cache到剛建立的虛擬磁碟Q中
robocopy "C:\Windows\Installer" Q:\ /e /copyall /move /zb
...等待.....
mkdir "C:\Windows\Installer"
echo y | cacls foo /s:"O:BAG:DUD:PAI(A;OICIID;FA;;;BA)(A;OICIID;FA;;;SY)(A;OICIID;FRFX;;;BU)(A;OICIID;FRFX;;;WD)"
查看P盤的GUID
mountvol
並將Installer目錄指向
mountvol "C:\Windows\Installer" \\?\Volume{xxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\
卸載盤符P
diskpart
select vdisk file="E:\VHD\Installer.vhd"
select partition 1
remove letter=Q
exit
開機自動掛載虛擬磁碟,並刪除盤符
echo select vdisk file=E:\VHD\Installer.vhd > E:\VHD\Installer.txt
echo attach vdisk >> E:\VHD\Installer.txt
schtasks /create /ru system /sc onstart /rl highest /tn "Attach Installer" /tr "%SystemRoot%\System32\diskpart.exe /s E:\VHD\Installer.txt"
【轉】轉移Package Cache檔案夾,轉移Windows Installer檔案夾