Example:Create a primary and a logical partition 建立一個主要分割區及一個延伸分割區,快速格式為為NTFS
CMD
#diskpart
disk1config.txt
Rem Seletct Disk1 選擇磁碟1
Select disk 1
list partition
Rem Clean Disk1 清除磁碟1
Clean
list partition
Rem Create the primary partition on the disk and assign the drive letter. 建立一個主要分割區10G,並指定磁碟機代為為 p
Create partition primary size=10240
assign letter=p
format fs=ntfs label="Primary"
list partition
Rem Create extended partition with 1 logical divers 建立一個主要分割區 10G,並指定磁碟機代為為 q
Create partition extended size=10240
list partition
Rem 1 logical
Create partition logical size=10240
assign letter=u
format fs=ntfs label="extended"
list partition
master.bat
@echo off
diskpart /s config.txt