📜  Windows 中的 Diskpart 命令

📅  最后修改于: 2022-05-13 01:56:11.499000             🧑  作者: Mango

Windows 中的 Diskpart 命令

DiskPart 是 Windows 操作系统下一个强大的磁盘管理工具。 Diskpart 命令用于管理计算机硬盘、分区和卷。此命令不仅限于 Windows 10,还可以在 Windows 8.1、8、7 甚至 Windows 2000 中使用。 Diskpart 用于从创建或删除分区到擦除驱动器清洁或修复驱动器上的错误。

Diskpart 看起来类似于磁盘管理工具,但唯一的区别是, diskpart是一个命令提示实用程序,它比磁盘管理工具更强大并提供更多功能。

让我们看看 Diskpart 如何帮助您管理驱动器、分区和卷。

注意:在使用 DiskPart 时,您应该始终以管理员模式运行计算机。

句法:

diskpart 

参数:

您可以从 Diskpart 命令解释器运行以下命令:

ACTIVE      - Mark the selected partition as active.
ADD         - Add a mirror to a simple volume.
ASSIGN      - Assign a drive letter or mount point to the selected volume.
ATTRIBUTES  - Manipulate volume or disk attributes.
ATTACH      - Attaches a virtual disk file.
AUTOMOUNT   - Enable and disable automatic mounting of basic volumes.
BREAK       - Break a mirror set.
CLEAN       - Clear the configuration information, or all information, off the
             disk.
COMPACT     - Attempts to reduce the physical size of the file.
CONVERT     - Convert between different disk formats.
CREATE      - Create a volume, partition or virtual disk.
DELETE      - Delete an object.
DETAIL      - Provide details about an object.
DETACH      - Detaches a virtual disk file.
EXIT        - Exit DiskPart.
EXTEND      - Extend a volume.
EXPAND      - Expands the maximum size available on a virtual disk.
FILESYSTEMS - Display current and supported file systems on the volume.
FORMAT      - Format the volume or partition.
GPT         - Assign attributes to the selected GPT partition.
HELP        - Display a list of commands.
IMPORT      - Import a disk group.
INACTIVE    - Mark the selected partition as inactive.
LIST        - Display a list of objects.
MERGE       - Merges a child disk with its parents.
ONLINE      - Online an object that is currently marked as offline.
OFFLINE     - Offline an object that is currently marked as online.
RECOVER     - Refreshes the state of all disks in the selected pack.
             Attempts recovery on disks in the invalid pack, and
             resynchronizes mirrored volumes and RAID5 volumes
             that have stale plex or parity data.
REM         - Does nothing. This is used to comment scripts.
REMOVE      - Remove a drive letter or mount point assignment.
REPAIR      - Repair a RAID-5 volume with a failed member.
RESCAN      - Rescan the computer looking for disks and volumes.
RETAIN      - Place a retained partition under a simple volume.
SAN         - Display or set the SAN policy for the currently booted OS.
SELECT      - Shift the focus to an object.
SETID       - Change the partition type.
SHRINK      - Reduce the size of the selected volume.
UNIQUEID    - Displays or sets the GUID partition table (GPT) identifier or
             master boot record (MBR) signature of a disk.

打开并列出驱动器或分区或卷:

在我们继续执行 DiskPart 命令之前,列出驱动器、分区或卷非常重要。请按照以下步骤列出驱动器:

  • 键入diskpart ,然后按Windows+R键并单击确定。

  • 在 DiskPart 命令窗口中,键入list disk并按Enter

  • 这将列出所有可用的驱动器,并从 0 开始为它们指定一个编号。
  • 如果要查看所有卷,请键入list volume并按Enter。

  • 这将列出所有可用的卷,并从 0 开始指定一个数字。

上面的文章,解释了 Windows 上diskpart命令的用例和参数。