For an end-user, formatting the USB drive is easy. All you need to do is right-click on the drive, and select Format. However, if you want to format a USB pen drive using the Command Prompt, here is how you can do it in Windows 10/8/7.
Format USB Pen Drive using CMD
When using the Command Prompt, you have two methods. One is using a simple format command while the other is using Diskpart. We will show both the processes.
- Using Format Command
- Using Diskpart tool.
When using the Diskpart tool, you will need admin privileges. You can also use PowerShell instead of CMD.
1] Using Format Command
Plug in the USB drive you want to format, and open File Explorer. Identify the exact drive name of the USB drive. Make sure not to make any mistakes here. If you use an incorrect drive letter, you will end up formating another partition and lose all the data.
- Make sure no copy process is in progress, and the drive is not open in the explorer.
- Type CMD in the Run Prompt, and hit enter to open the Command Prompt.
- Type FORMAT <Driveletter>: and hit the Enter key.
- It will prompt you to enter a new disk for Drive I. Just hit the Enter key again.
- If you get a prompt saying:
Format cannot run because the volume is in use by another process. Format may run if this volume is dismounted first.
ALL OPENED HANDLES TO THIS VOLUME WOULD THEN BE INVALID.
Would you like to force a dismount on this volume? (Y/N)
- Enter Y, and it will dismount the volume to format it. Its because some process is still accessing it. Unmounting will make sure all the processes accessing the drive will stop.
If you want to format with your choice of options, we suggest you to reading everything about the Format command here.
2] Using Diskpart Tool
DISKPART is a powerful tool that you can use to manage all the partitions from the command line. Before running this tool, make sure to remove the USB drive.
- Type diskpart in the Run Prompt, and hit enter
- After the UAC, it will open the Command Prompt which is running this tool
- Type LIST DISK to list all the drives connected to the computer.
- Now insert the USB drive, and then rerun the command.
- This time you will notice an extra drive that you need to format. In my case, it is DISK 2
- Next type SELECT DISK 2, and you will get a prompt Disk 2 is now the selected disk.
- Type CLEAN, and hit the Enter key
- Then type CREATE PARTITION PRIMARY and hit enter
- Type Format fs=NTFS Quick and hit enter
- Type Assign and hit Enter key to assign a letter to the newly formatted drive.
Post completion of all the tasks, the USB drive will be formatted, and it will be empty. DISKPART tool works differently compared to the standard format option in Windows.