@ECHO OFF
mkdir C:\vhdx
echo CREATE VDISK FILE="C:\vhdx\drive-d.vhdx" MAXIMUM=20480 TYPE=EXPANDABLE>C:\vhdx\drive-d.txt
echo ATTACH VDISK>>C:\vhdx\drive-d.txt
echo CREATE PARTITION PRIMARY>>C:\vhdx\drive-d.txt
echo FORMAT QUICK>>C:\vhdx\drive-d.txt
echo ASSIGN LETTER=D>>C:\vhdx\drive-d.txt
diskpart /s C:\vhdx\drive-d.txt
echo SELECT VDISK FILE="C:\vhdx\drive-d.vhdx">C:\vhdx\drive-d.txt
echo ATTACH VDISK>>C:\vhdx\drive-d.txt
schtasks /f /create /tn "diskpart-drive-d" /tr "diskpart /s C:\vhdx\drive-d.txt" /sc ONSTART /ru SYSTEM
schtasks /run /tn "diskpart-drive-d"
echo 好了,20G的D盘创建完成!
PAUSE