diskpart命令_Windows Diskpart命令教程

diskpart命令

diskpart命令

diskpart is a Windows utility to create partitions on the disk. It is similar to the Linux fdisk utility. diskpart provides an interactive command shell where we will enter related commands to partition, format disk, and volumes. In order to run diskpart we need Administrator privileges. The best way to get Administrator privilege is opening MS-DOS as Administrator by right-clicking on it.

diskpart是Windows实用程序,用于在磁盘上创建分区。 它类似于Linux fdisk实用程序。 diskpart提供了一个交互式命令外壳,我们将在其中输入相关命令来分区,格式化磁盘和卷。 为了运行diskpart,我们需要管理员权限。 获得管理员特权的最佳方法是通过右键单击以管理员身份打开MS-DOS。

diskpart命令交互模式 (diskpart Command Interactive Mode)

diskpart is mainly used by its interactive shell. So we should enter this shell with the diskpart command. All commands issued bellow are used in interactive diskpart shell.

diskpart主要由其交互式外壳使用。 因此,我们应该使用diskpart命令输入此shell。 下面发布的所有命令都在交互式diskpart shell中使用。

> diskpart
Interactive Mode
Interactive Mode
互动模式

diskpart命令帮助(diskpart Command Help)

There are a lot of command supported by diskpart . We can list these commands with help

diskpart支持很多命令。 我们可以在help这些命令

> help
Help
Help
帮帮我

列出磁盘和分区(List Disk and Partitions)

First we need to know how many disk there are. We will use list disk command for this. We will also get following information about disks.

首先,我们需要知道有多少个磁盘。 我们将为此使用list disk命令。 我们还将获得有关磁盘的以下信息。

  • Status

    状态
  • Size

    尺寸
  • Free

    自由
  • GPT

    GPT
> list disk
List Disk and Partitions
List Disk and Partitions
列出磁盘和分区

选择要格式化的磁盘(Select Disk To Format)

Now we will select the second disk which is numbered as 1. Because disk numbers start from 0. We will use select disk 1 . In order to execute format commands, we should select a disk.

现在,我们将选择第二个磁盘,编号为1。因为磁盘号从0开始。我们将使用select disk 1 。 为了执行格式化命令,我们应该选择一个磁盘。

> select disk 1
Select Disk
Select Disk
选择磁盘

清理驱动器分区表和信息(Clean Drive Partition Table and Information)

If there is an already set configuration we should clear them to make things simple.  We will use clean command.

如果已经设置好配置,我们应该清除它们以简化操作。 我们将使用clean命令。

> clean
Clean Drive
Clean Drive
清洁驱动器

检查磁盘选择(Check Disk Selection)

In order to execute commands to format disk we should select the disk and partition. We have already selected disk but we can check this selection with list disk command too. Selected disk will have asterisk before its name.

为了执行格式化磁盘的命令,我们应该选择磁盘和分区。 我们已经选择了磁盘,但是我们也可以使用list disk命令检查此选择。 所选磁盘的名称前将带有星号。

> list disk
Check Disk Selection
Check Disk Selection
检查磁盘选择

创建新的分区表(Create New Partition Table)

We will create a partition on the selected disk. We will issue create partition primary. There are primary and secondary partition types. IF we have less than 5 partitions in a disk we can use primarily for all of them.

我们将在所选磁盘上创建一个分区。 我们将发布create partition primary。 有主分区和辅助分区类型。 如果磁盘中的分区少于5个,则可以将其主要用于所有分区。

> create partition primary
Create Partition
Create Partition
创建分区

列出现有分区表和信息(List Existing Partition Table and Information)

Now we can list partition we have already created. We will use list partition command for this. Also following information about partition will be listed

现在我们可以列出已经创建的分区。 我们将为此使用list partition命令。 此外,还将列出有关分区的以下信息

  • Partition name

    分区名称
  • Partition Type

    分区类型
  • Szie

    西耶
  • Offset

    抵消
> list partition
List Partition
List Partition
列表分区

选择要修改的分区(Select Partition To Modify)

In order to operate on the given partition, we should select the partition with the select partition command. This will select selected disks given partition according to number.

为了对给定的分区进行操作,我们应该使用select partition命令选择该分区。 这将根据编号选择给定分区的选定磁盘。

> select partition 1
Select Partition
Select Partition
选择分区

激活分区(Activate Partition)

In order to use partition we will activate it. We will use active command.

为了使用分区,我们将激活它。 我们将使用active命令。

> active
Activate Partition
Activate Partition
激活分区

格式化分区(Format Partition)

This is one of the most important part. We will format the selected and activated partition. We will use format command. Also, we will specify the file system type with the FS option. label option is used to set the name of partition which is shown to the user. quick specifies the format operation speed. In this example, we set file system type NTFS and label D

这是最重要的部分之一。 我们将格式化选定并激活的分区。 我们将使用format命令。 另外,我们将使用FS选项指定文件系统类型。 标签选项用于设置显示给用户的分区名称。 quick指定格式操作速度。 在此示例中,我们设置文件系统类型为NTFS ,标签为D

> format FS=NTFS label=D quick
Format Partition
Format Partition
格式化分区

分配字母(Assign Letter)

In order to use the partition, we should assign a letter to the formatted partition. We will use assign command with letter option. In this example, we assign letter E to the partition.

为了使用分区,我们应该为格式化的分区分配一个字母。 我们将使用带letter选项的assign命令。 在此示例中,我们为分区分配字母E

> assign letter=E
Assign Letter
Assign Letter
分配字母

We can see from screenshot that we have tried to assign D previously which is already assigned. This produced error and operation is not completed.

从屏幕截图中可以看到,我们已经尝试分配先前已分配的D 产生的错误和操作未完成。

LEARN MORE  Compare FAT32 vs exFAT vs NTFS File Systems
了解更多比较FAT32与exFAT与NTFS文件系统

从Diskpart Interactive Shell退出(Exit From Diskpart Interactive Shell)

We can exit from the diskpart interactive shell with exit command like below.

我们可以使用如下的exit命令从diskpart交互式shell中exit

> exit

翻译自: https://www.poftut.com/windows-diskpart-command-tutorial-examples-format-disk/

diskpart命令

  • 2
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值