Initializing and formatting disks can easily be done in Windows 10 using Disk Management or even from the “This PC” screen in File Explorer. But for times when you want a bit more control, or if you can’t fully boot into Windows 10, knowing how to format a disk using the command line can come in handy. The command line includes a partitioning utility called diskpart you can use to format both local and attached storage. In this article, we’ll show you how to use it in Windows 10 and how you can access it during Windows 10 installation.
Initialize Local Disks and Attached Storage Using DiskPart in Windows 10
To start, launch the command prompt in Windows 10. The quickest way to do that is to press Windows key + X then click Command Prompt (Admin). At the command prompt, type: diskpart then hit enter. This will start the disk partitioning command line utility.
Type list disk then hit Enter.
This will reveal all attached storage devices. As you can see below, both my local hard disk ( 20 GB partition) and my external storage (2 GB) are attached. In my case, the drive I want to format is the 2 GB partition.
To select the small partition, type: select disk 1 then hit Enter – this is the small 2 GB partition I want to format. If you had more storage devices connected or attached, they would be listed as disk 0, 1, 2, 3, etc.
Once the drive has been selected, type clean then hit Enter.
Type create partition primary then hit Enter
Type active then hit Enter
Type format fs=exfat label=”DRIVE LABEL HERE” quick then hit Enter
This command will format and label the drive, e.g. format fs=exfat label=”Groovy”. If you are formatting a local disk, you should use NTFS in place of exFAT, or you can choose from other appropriate file systems such as FAT32.
Type exit and hit Enter again.
There are other ways you can access the DiskPart command line utility, too. When performing a new installation of Windows 10, you can use DiskPart to format and prepare storage devices. Upon arriving at the Custom/Advanced screen, press Shift + F10 to launch the command line, then type: diskpart to launch the Disk Partitioning utility.
If you are unable to boot to the Windows 10 desktop, you can also access the command prompt from the Recovery Environment.
Remember, this is not limited to just local storage or external storage; you can use it to format SD Cards too in addition to preparing your local hard disk for a fresh installation of Windows 10 during setup.
As always, let us know what you think in the comments and let us know what if there any other mundane tasks you would like to try out in the command line.