How to Format Pendrive using Command Line

Not sure how to format a pendrive using cmd on Windows 10 and earlier versions? This guide explains two methods that use command prompt to clean USB flash drive. Usually, a USB flash drive needs to format when either it is write-protected, filled with old junk files, virus-infected, or damaged.

How to Format Pendrive using Command Prompt

There are two ways to format pendrive using Command Prompt. Make sure to take proper backup of your valuable data before you execute below command line.

Method I

1) Insert the Pendrive which you want to format, into the system.

2) Now, go to My Computers and check the drive letter where the Pendrive has been inserted. That is the drive you will have to format.

My Computers and Check the Drive space

3) Now, press Windows and R keys together and type Command 

4) Right-click over it and select “Command Prompt (Admin)” from the pop-up menu and run it as administrator.

Run command to run as an administrator in Windows 10

5) In the command prompt window type:

format <drive name you want to format>:

Format Command for pendrive

6) Hit Enter key

7) After the message “and press ENTER when ready…” appears, hit the Enter key again and wait until the percent completed reaches 100.

Process continue upto 100 percent

8) After the message “Volume label (11 characters, ENTER for none)?” appears, hit the enter key again.

Volume serial message

Now, your Pendrive successfully formatted using the command line.

But the question arises that why someone format pendrive using cmd, when someone can clean the drive using right-click over the drive. Well, many times the USB drive damaged or corrupt or infected by the virus, in that case, the user-interface option to format the drive doesn’t work. But this can be done using the command prompt, and that’s why this cmd uses to format the pendrive.

Method II

1) Connect the Pendrive you want to format, to your system. Check its size by going to its Properties.

Check Pendrive Format

2) Click on Start button, type cmd

3) Right-click over cmd.exe and choose Run as Administrator  

4) In the command prompt window type diskpart. Press Enter to enable the service.

Type Command Diskpart

5) Now, type list disk. Press Enter to view all the disks on the system along with their status and size.

View all the Disks Status and Size

6) Select the disk which you want to format by identifying the size of the disk seen in step 1. And then type select disk <number>. Press Enter.

Select Disk press enter to format drive

7)  Now, type clean and press Enter. This takes some time to finish.

Type Clean Command and Press Enter

8) Now, type creates partition primary. Press Enter. This creates the partition specified.

Create Partition primary step

9) Type select partition 1

Select Partition 1 option

10) Type active to activate the partition created and press Enter.

Activate the Partition by active command

11) Type format fs=ntfs quick if your Pendrive is more than 32 GB. Type format fs=fat32 quick if your Pendrive is less than 32 GB. This formats the disk’s volume quickly.

Type format fs=ntfs

12) Now, type assign to assign the drive letter or mount point, as the case may be, for Pendrive.

Assign the Drive letter or mount point

13) Once done, type exit to close the diskpart utility

Exit to close the diskpart utility

14) Type exit again to close the command prompt window.

Close the Command prompt Window



Founder and Writer @ WinOSBite. Future plan is to make this platform open to community to resolve and discuss various issues, usage related to Operating System.

Leave a Reply

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