rem # https://docs.microsoft.com/zh-tw/windows-hardware/manufacture/desktop/configure-uefigpt-based-hard-drive-partitions
rem # https://learn.microsoft.com/zh-tw/windows-hardware/manufacture/desktop/oem-deployment-of-windows-desktop-editions-sample-scripts?view=windows-11&preserve-view=true#-createpartitions-uefitxt
rem == 2025-03-15 15:24:18

rem == CreatePartitions-UEFI.txt ==
rem ##	 DiskPart /s B:\CreatePartitions-UEFI_AnyDiskSize_1TB.txt	##

rem == 0. Clean Disk ==
rem #edit# select disk N0123
rem #edit# clean
rem #edit# convert gpt

rem ---- For Windows 11 ----
rem #edit# select partition 1
rem #edit# delete partition override

rem == 1. Microsoft Reserved (MSR) partition ==
create partition msr size=16

rem == 2. System partition ==
create partition efi size=260
format quick fs=fat32 label="System" OverRide
assign letter="S" NoErr

rem == 3. Windows partition ==
rem 975427584/1024/2=476283 MB
create partition primary size=476283

format quick fs=ntfs label="Windows" OverRide
assign letter="W" NoErr

rem == 4. Recovery partition ==
create partition primary size=1024
format quick fs=ntfs label="Recovery" OverRide
set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac" OverRide
assign letter="R" NoErr

rem == 4.1 Data partition ==
create partition primary size=476285
format quick fs=ntfs label="Data" OverRide
assign letter="U" NoErr

rem == 5. Restore partition ==
create partition primary
rem ---- shrink 2 GB ----
shrink desired=2048 OverRide
format quick fs=ntfs label="Restore" OverRide
assign letter="T" NoErr

rem == 6. Windows_PE partition ==
create partition primary size=2048
format quick fs=fat32 label="Windows_PE" OverRide
assign letter="P" NoErr

list volume
list partition
exit