用于自动执行 diskpart 命令的批处理脚本

问题描述 投票:0回答:0

你好我想创建一个文件(批处理)来自动执行这些命令:

Select disk 0
Clean
Convert gpt
Create partition efi size=300
Assign letter=k 
Format quick fs=FAT32
Create partition msr size=128
Create partition primary
Assign letter=c 
Format quick fs=NTFS
Exit

你认为这在这里行得通吗,如果行不通,你能给我一些建议吗

@echo off

echo Running Diskpart...
echo Selecting Disk 0...
echo select disk 0 > commands.txt
echo Cleaning Disk...
echo clean >> commands.txt
echo Converting to GPT... 
echo convert gpt >> commands.txt
echo Creating EFI partition...
echo create partition efi size=300 >> commands.txt
echo assign letter=k >> commands.txt
echo format quick fs=FAT32 >> commands.txt
echo Creating MSR partition... 
echo create partition msr size=128 >> commands.txt
echo Creating Primary partition... 
echo create partition primary >> commands.txt
echo assign letter=c >> commands.txt
echo format quick fs=NTFS >> commands.txt
echo Exiting Diskpart...
echo exit >> commands.txt

diskpart /s commands.txt

echo Finished running Diskpart.

看起来你的帖子主要是代码;请添加更多详细信息。

batch-file diskpart
© www.soinside.com 2019 - 2024. All rights reserved.