使用 DiskPart 格式化 USB 磁盘会产生“未选择卷”错误

Sar*_*ger 5 usb hard-drive diskpart partitioning windows-10

我使用以下diskpart.exe顺序。我想指定磁盘号,然后格式化磁盘。

C:\>diskpart

Microsoft DiskPart version 10.0.18362.1

Copyright (C) Microsoft Corporation.
On computer: AAAAAAA

DISKPART> select disk 2

Disk 2 is now the selected disk.

DISKPART> clean

DiskPart succeeded in cleaning the disk.

DISKPART> create partition primary

DiskPart succeeded in creating the specified partition.

DISKPART> format fs=ntfs label="My USB Disk" quick

There is no volume selected.
Please select a volume and try again.

DISKPART>
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,该脚本应该可以工作并且可能会运行Windows 7,正如在互联网上搜索的几个页面所说的那样,但在我的Windows 10安装中我得到了

没有选择音量

本文不适用作者确实忘记了create primary partition这里同上。

正如您从该屏幕截图中看到的,磁盘 2 上肯定有一个卷。

显示单个卷的 diskpart

我的 USB 闪存驱动器只有一个卷,因此format应该可以使用。

想法?

har*_*ymc 2

代码几乎是正确的,但这里缺少一个片段。根据您的需要修改它。

create partition primary
select partition 1
active
format fs=ntfs label="My USB Disk" quick
assign letter=D
Run Code Online (Sandbox Code Playgroud)