How to Format Local Disks, USB Storage and SD Cards Using DiskPart in Windows 10

Formatting disks in the command line can come in handy if you can’t boot into Windows 10, or if you simply want more control.

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.

DiskPart Windows 10 command line

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.

DiskPart Windows 10 command line

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.

DiskPart Windows 10 command line

Once the drive has been selected, type clean then hit Enter.

DiskPart Windows 10 command line

Type create partition primary then hit Enter

DiskPart Windows 10 command line

Type active then hit Enter

DiskPart Windows 10 command line

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.

DiskPart Windows 10 command line

Type exit and hit Enter again.

DiskPart Windows 10 command line

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.

DiskPart Windows 10 command line

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.



  1. Joe Carreira

    January 28, 2017 at 1:06 pm

    Excellent tip. Regards

  2. Paul

    February 2, 2017 at 10:14 pm

    Love Diskpart, always fire it up during a clean install to “clean” the target disk

  3. Ronald Hoover

    June 16, 2017 at 6:41 pm

    Is there away to fly a drone and play music on the same SD Disk at the same time that you are recording scenery. That would require two tracks one for music and the other for the scenery. one track for recording the video and the other for the music I should think! Drones can record the sound of the props make and the picture at the same time. You should be able to record the video and then put the sd disk in your computer to record music without copying the sound over the video.Thus wiping the video out.

  4. tziamanik

    July 4, 2020 at 2:25 am

    Best Tip ever! i have a 2TB disk that can only be exfat formatted windows diskmgr could not make the job.
    You wrote the commands and you have also photo examples!

Leave a Reply

Your email address will not be published. Required fields are marked *


To Top