in

How to Format USB in CMD

It’s Easy

How to Format USB in CMD
  • Plug USB in your computer and open command prompt as an administrator.
  • Write the command format /q /x H and press enter to execute the command.
  • The “H” in the format command is the letter assigned to the USB drive.
  • You can also use Diskpart command to format USB in CMD.

The USB flash drive is used for transferring files from one computer to another. There are many instances when you have to format your USB drive because of the viruses in it. So, we format the USB to clean it from the viruses. Here’s how to format USB in CMD.

To format a USB is an easy process but sometimes we are not able to format it using this process. To format a USB, you have to open the file explorer and right-click on the USB drive. When you right-click on it, you will see a list of options. Click on the format to complete this formatting process.

This is the simple way to format a USB drive in windows but there are instances where this process fails to format USB. You will get error messages like Windows was unable to complete the format. When you get this sort of error message in windows then you cannot format USB with this process. So to format USB, you have to use the command prompt. In this article, we will tell you how to do it and when you feel the need to do it.

Firstly, we will discuss things about USB flash drive and how we can transfer data from PC to another in windows. Secondly, we will discuss the procedure of formatting USB using command prompt (CMD). Lastly, we will also discuss another way to format a USB flash drive.

How to Format USB in CMD

What is a USB Flash Drive?

The USB flash drive is a removable and rewriteable data storage device. We use the USB flash drive, to transfer and store data. To transfer any file from one PC to another, you need to copy the file from your computer and paste it in the USB flash drive if you are using Windows.

USB flash drive is the fastest and easiest way to transfer and store files. USB is far better as compared to CDs or floppy disks. The storage capacity of USB flash drives is up to 2TB. Nowadays, most people use USB to store and transfer data in a PC. Three factors determine the transfer speed of USB. First is the version of the USB, second is the speed of the bus in which the USB device can read and write data in to. Lastly is the hardware bus speed.

Determining Speed of the USB

These are some of the factors which determine the transfer speed of the data from one device to another in Windows. We can make USB flash drive bootable as well. You need to use third-party software to make your USB bootable. When we have to update or install windows on the computer, we make USB a bootable drive and install the windows on our PC.

How USB get Infected with Virus

As we use USB to store and transfer files so there are many chances that it might get infected with the virus. This plug and play feature of USB makes it easy for the users to transfer files anytime they want. However, this plug and play feature also makes it prone to viruses.

For instance, you want to copy software from a friend’s laptop and your friend’s laptop has some viruses. When you plug your USB in your friend’s laptop and copy-paste the software in the USB flash drive. There is a possibility that your USB flash drive gets infected with viruses.

Whenever you are going to plug it in your PC then there is a chance that your PC might get infected with the same virus as well unless you have any anti-virus software. There are different kinds of viruses and to know which kind of virus is on your USB flash drive is not possible. However, it is better to clean your USB before using it and to do that you have format the USB flash drive. Therefore we will tell you about the procedure to format USB using command prompt (CMD).

Formatting USB in Command Prompt (CMD) 

When you cannot format USB flash drive with the simple process mentioned earlier in the article then you have to use CMD. There are two ways to format USB in CMD. One is with the simple format command and other is using Diskpart command. Firstly, we will discuss the procedure of formatting USB in CMD with format command.

Formatting USB in CMD (Format Command)

To format a USB flash drive in CMD, you need to open command prompt first. Just follow the instructions given below.

  • Write CMD in the search box and press enters to open a command prompt. You can access search box from the taskbar.
  • Press Windows key + R to open the Run app. After that type CMD and press enter.
  • Open the command prompt as administrator.
  • After that, plug your USB flash drive in your computer.
  • Now you need to type the following command to format USB.

format /q /x H:

Image of the CMD

  • In the above-mentioned command “q” is for quick formatting, “x” is for dismounting the selected volume and “H” is the assigned letter of the drive.
  • Firstly, check the drive letter of USB in your computer and write that letter in the command.
  • After that, you have to press enter. You will see the following message displayed on the screen.

“Insert new disk for drive H: and press ENTER when ready..”

  • Now you have to press enter again to start the USB formatting process.

After that, it will ask you to enter a volume label for the USB flash drive. Write this /v: after format command to set volume label. You can use it with this command “format /q /x H:” as well.

  • If you don’t want to enter the volume label then you can just enter.

Screenshot of the CMD

  • After that, the process completion message will be displayed on your screen.
  • Now you will see that your USB is formatted and there is no data in it.

This is the one way to format USB in CMD but you can do it using another command. Now we will provide the step by step procedure of using Diskpart command in CMD, to format USB.

Formatting USB Flash Drive in CMD (Diskpart Command)

To format USB in CMD with Diskpart command, you need to follow some instructions. Follow the instructions given below.

  • Firstly, you need to open a command prompt. Write CMD in search and run it as administrator.
  • After that, plug your USB flash drive in the computer.
  • Now to format USB, we need to use the Diskpart
  • Write diskpart, when you open a command prompt in windows.

Show of CMD using the Diskpart command

  • After that, press enter.
  • Now write command list disk. When you execute this command, you will see the list of disks on your computer.

Using the command List Disk in CMD

  • After that, identify the USB drive from the list. You can identify the USB using its size. For example, if your USB size is 16 GB then the drive with 16 GB will be your USB drive.
  • When you identify the USB drive from a list of disks then you have to write the following command.

select disk <disk number> 

  • In place of disk number, you have to write the actual disk number of the USB drive that you identified in step 7. For instance, if the drive number is 3 then the command will be like select disk 3.
  • After writing the actual disk number in the above command. Press enter to execute it.
  • Now you have to execute the “clean” command to format the USB flash drive.
  • Write clean and press enter.
  • After that, you have to create a primary partition of the drive. To do that you need to write the following command.

“create partition primary”.

  • Now you have to write the command “format fs = ntfs quick” to format the drive.
  • The above command is for NTFS file system but if you want to replace it with FAT32 then replace NTFS with FAT32. The command will be like “format fs = FAT32 quick”.
  • The quick in the command is the instruction for windows to format it quickly.
  • The process is not completed yet because you have to assign the drive letter for the USB drive. Otherwise, you will not be able to see the USB flash drive in the file explorer.
  • Now write the following command, to assign the letter to the formatted USB drive.

Diskpart> assign

  • After that, Windows will assign the drive letter to the USB drive.

How to Format USB in CMD

  • To close this diskpart tool, you need to execute the exit command. Write “exit” in front of Diskpart and press enter to execute it.

The message of success on CMD

  • Now close the command prompt by clicking on “X” button on the title bar.
  • You can open the file explorer, to check all drives on your computer.

The diskpart utility process is long and hard for some people but it is the best way to format a USB in CMD. You can use the format command process which is easy for many people. For people convenience, we will also discuss how to format USB using disk management tool.

Formatting USB with Disk Management Tool

To format USB with Disk management tool, you have to follow some steps. The steps are the following.

  • Press Windows key + R, to open the Run app.
  • Now write “msc” and press enter to open Windows Disk Management.
  • You should plug the USB first before opening the Windows Disk Management tool.
  • After that, Right-click on the USB drive and click on the format from the list of options.
  • Now you need to select the file system to format the USB drive in to. IT is either FAT32 or NTFS.
  • Click OK to format the USB drive.

Conclusion

These are some of the methods to format the USB drive and you can use all these methods in any version of the windows. Make sure that you follow all the instructions correctly otherwise you might not be able to format your USB flash drive. If you don’t face any issues in the simple formatting of USB via file explorer then you don’t need to use CMD. Just open file explorer and right-click on the USB drive to format it.

In short, you don’t have to follow the long CMD procedures to format the USB if you don’t encounter error messages like “Windows cannot format the drive“. If you face any difficulty in the formatting process then you should use the command prompt method.

Written by Umer Zahid