How to Format Pen Drive using CMD?

You can format pen drive using CMD in Windows 7, 8, 10, 11 if you failed to format it using File Explorer or Disk Management.


By Bryce / Updated on May 12, 2023

Share this: instagram reddit

My pen drive not formatting

“My friend gave me a 32GB pen drive. When I tried to format it to NTFS in File Explore, I just got the message Windows was unable to complete the format. I entered Disk Management to format the USB drive but still failed. Is my pen drive corrupted? How can I format it to NTFS successfully?”

Pen Drive not Formatting

Format pen drive using CMD

If you are in the situation mentioned above, you may find that your pen drive becomes RAW in Disk Management. That is to say, the file system of the pen drive partition is corrupted or damaged.

RAW Pen Drive

In such a condition, you can format your pen drive, SD card, or external hard drive using CMD. See the detailed steps below (Take formatting pen drive in Windows 7 as an example)

Note: Formatting pen drive will remove all data on it, thus you can make a backup at first if there are any necessary files on it.

1. In the Search box, type “CMD”, right-click Command Prompt among pop-up results, and select Run as administrator to open Command Prompt.

2. In the appearing window, type diskpart and hit Enter.

3. Run the following commands:

▪ list disk (all disks connected to your computer will be listed)
▪ select disk n (“n” is the number of your pen drive)
▪ clean
▪ create partition primary
▪ select partition 1
▪ format fs=ntfs (you can replace ntfs with exfat or fat32 if you want )
▪ assign drive letter f (“f” can be replaced if you want)

Format Pen Drive using CMD

Then, you can type “exit” and hit Enter to close this window.

If you receive the message that Diskaprt has encountered an error: the media is write-protected while running “clean” command, you can run these commands: list disk> select disk n>attributes disk clear readonly, to disable write protection from pen drive at first.

Format pen drive using a GUI format tool

If you are not familiar with Command Prompt, it is not advised to format pen drive using CMD as the operations mentioned above are irreversible and you may format the wrong disk, which will cause data loss. If you want to format the partition larger than 32GB, the Diskpart utility can’t help you. At this point, this excellent and powerful free format tool – AOMEI Partition Assistant Standard will be your best choice.

It is designed with an intuitive graphic user interface, allowing you to handle it easily and effectively. Breaking the limitation of 32GB, enabling you to format 64GB, 128GB even larger drive to FAT32; Besides, it offers you various file systems, covering NTFS, exFAT, FAT32, Ext4, Ex3, and Ext2, making it possible to format the drive for other operating systems like Linux. You get more advanced features like recovering lost partition on USB drive, migrating OS to GPT SSD, etc., if you upgrade to Professional version.

► Now, free download it and have a look at how it works.

Download FreewareWin 11/10/8.1/8/7/XP
Secure Download

Step 1. Run and open the software. Right-click the partition on the pen drive and choose “Format Partition”.

Step 2. In the pop-up dialogue, choose a file system based on your demand. (For example, if you need to format the drive with the file system compatible with Mac and Windows, exFAT can be your choice.)

Step 3. Return to the main interface. Click “Apply” and “Proceed” after confirming the operation.

After a while, you will have formatted your pen drive to exFAT or other file systems in a success. Enter Disk Management, you can see that the pen drive has been formatted with FAT32 file system.


When Windows File Explorer or Disk Management failed to format pen drive, it is not a bad choice to format pen drive using CMD. But if you want to format pen drive more simply and flexibly, it is recommended to pick up AOMEI Partition Assistant. It can not only format drive, but also make conversion between NTFS and FAT32 file system. 

Bryce · Staff Editor
Bryce is an editor of AOMEI Technology, he covers backup & restore, hard disk & partitions management, cloud files transfer, website & database backup and so on for AOMEI. He enjoys helping people find solutions to their problems. He loves traveling, Sleeping, reserching and so on. He enjoys helping people find solutions to their problems. He loves traveling, Sleeping, reserching and so on. He would like to spend all time on reaserching computer problems. He is a very cute boy.