以下命令解释是,首先在D盘,创建300G,,名为windows.vhd文件,类型为动态扩展,然后挂载再进行EFI分区,分两个区,第一个是100G,然后是198G。
(echo create vdisk file=d:\windows.vhd maximum=300000 type=expandable &echo attach vdisk&echo select vdisk file=d:\windows.vhd&echo clean&echo convert gpt&echo CREATE PARTITION EFI SIZE=256&echo FORMAT t quick fs=NTFS&echo CREATE PARTITION msr size=128&echo CREATE PARTITION PRIMARY size=102400&echo ASSIGN LETTER=F&echo FORMAT QUICK FS=NTFS LABEL="System"&echo CREATE PARTITION PRIMARY&echo FORMAT QUICK FS=NTFS LABEL="SoftApp"&echo ASSIGN LETTER=G&echo exit)|diskpart
一条命令的好处是部署自动化的时候特别爽。当然你也可以用ECHO,写入临时文件然后导入也行。
以下是/s 脚本文件的参数
create vdisk file=d:\windows.vhd maximum=300000 type=expandable
attach vdisk
select vdisk file=d:\windows.vhdcleanconvert gptCREATE PARTITION EFI SIZE=256FORMAT t quick fs=NTFSCREATE PARTITION msr size=128CREATE PARTITION PRIMARY size=102400ASSIGN LETTER=FFORMAT QUICK FS=NTFS LABEL="System"CREATE PARTITION PRIMARY FORMAT QUICK FS=NTFS LABEL="SoftApp"ASSIGN LETTER=Gexit
For /f "delims=" %%a in ('wmic diskdrive get index') do SET DiskIndex=%%a
(echo select %DiskIndex%&echo clean&echo convert gpt&echo CREATE PARTITION EFI SIZE=256&echo FORMAT t quick fs=NTFS&echo CREATE PARTITION msr size=128&echo CREATE PARTITION PRIMARY size=102400&echo ASSIGN LETTER=F&echo FORMAT QUICK FS=NTFS LABEL="System"&echo CREATE PARTITION PRIMARY&echo FORMAT QUICK FS=NTFS LABEL="SoftApp"&echo ASSIGN LETTER=G&echo exit)|diskpart
这里再帖一个脚本,用于真实环境下,只有一块硬盘下自动分2个区,当然你也可以3个区。根据自己的实际情况来操作。