官方网址:https://msdn.microsoft.com/zh-cn/library/windows/hardware/dn898441(v=vs.85).aspx
系统部署要用到的文件,微软官方脚本
1.如果是UEFI模式,用CreatePartitions-UEFI.txt ,ApplyImage-UEFI.bat
2.如果是legacy模式,用CreatePartitions-BIOS.txt ,ApplyImage-BIOS.bat
3.winpe下直接运行
diskpart /s d:\CreatePartitions-UEFI.txt
ApplyImage-UEFI.bat d:\install.wim
此时重启就可进入系统了
CreatePartitions-UEFI.txt ,
rem == CreatePartitions-UEFI.txt ==
rem == These commands are used with DiskPart to
rem create four partitions
rem for a UEFI/GPT-based PC.
rem Adjust the partition sizes to fill the drive
rem as necessary. ==
select disk 0
clean
convert gpt
rem == 1. System partition =========================
create partition efi size=100
rem ** NOTE: For Advanced Format 4Kn drives,
rem change this value to size = 260 **
format quick fs=fat32 label="System"
assign letter="S"
rem == 2. Microsoft Reserved (MSR) partition =======
create partition msr size=16
rem == 3. Windows partition ========================
rem == a. Create the Windows partition ==========
create partition primary
rem == b. Create space for the recovery tools ===
shrink minimum=500
rem ** NOTE: Update this size to match the
rem size of the recovery tools
rem (winre.wim) **
rem == c. Prepare the Windows partition =========
format quick fs=ntfs label="Windows"
assign letter="W"
rem === 4. Recovery partition ======================
create partition primary
format quick fs=ntfs label="Recovery"
assign letter="R"
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac"
gpt attributes=0x8000000000000001
list volume
exit
CreatePartitions-BIOS.txt
rem == CreatePartitions-BIOS.txt ==
rem == These commands are used with DiskPart to
rem create three partitions
rem for a BIOS/MBR-based computer.
rem Adjust the partition sizes to fill the drive
rem as necessary. ==
select disk 0
clean
rem == 1. System partition ======================
create partition primary size=100
format quick fs=ntfs label="System"
assign letter="S"
active
rem == 2. Windows partition =====================
rem == a. Create the Windows partition =======
create partition primary
rem == b. Create space for the recovery tools
shrink minimum=500
rem ** NOTE: Update this size to match the
rem size of the recovery tools
rem (winre.wim) **
rem == c. Prepare the Windows partition ======
format quick fs=ntfs label="Windows"
assign letter="W"
rem == 3. Recovery partition ====================
create partition primary
format quick fs=ntfs label="Recovery"
assign letter="R"
set id=27
list volume
exit
ApplyImage-BIOS.bat
rem == ApplyImage-BIOS.bat ==
rem == These commands deploy a specified Windows
rem image file to the Windows partition, and configure
rem the system partition.
rem Usage: ApplyImage WimFileName
rem Example: ApplyImage E:\Images\ThinImage.wim ==
rem == Copy the image to the recovery partition ==
md R:\RecoveryImage
copy %1 R:\RecoveryImage\Install.wim
rem == Apply the image to the Windows partition ==
dism /Apply-Image /ImageFile:"R:\RecoveryImage\Install.wim" /Index:1 /ApplyDir:C:\
rem == Copy boot files to the System partition ==
C:\Windows\System32\bcdboot C:\Windows
:rem == Copy the Windows RE image to the
:rem System partition ==
md S:\Recovery\WindowsRE
xcopy /h C:\Windows\System32\Recovery\Winre.wim S:\Recovery\WindowsRE\
:rem == Register the location of the recovery tools ==
C:\Windows\System32\Reagentc /Setreimage /Path S:\Recovery\WindowsRE /Target C:\Windows
:rem == Register the location of the
:rem push-button reset recovery image. ==
C:\Windows\System32\Reagentc /Setosimage /Path R:\RecoveryImage /Target C:\Windows /Index 1
:rem == Restrict permissions of recovery folder to local Admin group
C:\Windows\System32\icacls R:\RecoveryImage /inheritance:r /T
C:\Windows\System32\icacls R:\RecoveryImage /grant:r SYSTEM:(F) /T
C:\Windows\System32\icacls R:\RecoveryImage /grant:r *S-1-5-32-544:(F) /T
:rem == Verify the configuration status of the images. ==
C:\Windows\System32\Reagentc /Info /Target C:\Windows
ApplyImage-UEFI.bat
rem == ApplyImage-UEFI.bat ==
rem == These commands deploy a specified Windows
rem image file to the Windows partition, and configure
rem the system partition.
rem Usage: ApplyImage WimFileName
rem Example: ApplyImage E:\Images\ThinImage.wim ==
rem == Copy the image to the recovery partition ==
md R:\RecoveryImage
copy %1 R:\RecoveryImage\Install.wim
rem == Apply the image to the Windows partition ==
dism /Apply-Image /ImageFile:"R:\RecoveryImage\Install.wim" /Index:1 /ApplyDir:C:\
rem == Copy boot files to the System partition ==
C:\Windows\System32\bcdboot C:\Windows /s S:
:rem == Copy the Windows RE image to the
:rem Windows RE Tools partition ==
md T:\Recovery\WindowsRE
xcopy /h C:\Windows\System32\Recovery\Winre.wim T:\Recovery\WindowsRE\
:rem == Register the location of the recovery tools ==
C:\Windows\System32\Reagentc /Setreimage /Path T:\Recovery\WindowsRE /Target C:\Windows
:rem == Register the location of the
:rem push-button reset recovery image. ==
C:\Windows\System32\Reagentc /Setosimage /Path R:\RecoveryImage /Target C:\Windows /Index 1
:rem == Restrict permissions of recovery folder to local Admin group
C:\Windows\System32\icacls R:\RecoveryImage /inheritance:r /T
C:\Windows\System32\icacls R:\RecoveryImage /grant:r SYSTEM:(F) /T
C:\Windows\System32\icacls R:\RecoveryImage /grant:r *S-1-5-32-544:(F) /T
:rem == Verify the configuration status of the images. ==
C:\Windows\System32\Reagentc /Info /Target C:\Windows