How to Format A USB from the Windows CMD

By Tanner Abraham •  Updated: 09/02/22 •  4 min read

Formatting a USB is one of those computer operations that everyone should know. Regardless of whether you frequently go to format your flash drives or if you do it once a year. Formatting a USB is one of the simplest things that can be done on the computer, and that helps considerably in cleaning and even protecting your own storage device. Although the traditional process can be done without much complication from Windows, today we would like to show you another alternative, which, in our opinion, turns out to be much more efficient and secure, although it is somewhat more elaborate.

It is about formatting the USB memory through the CMD or Windows command block. As you know, Windows allows the use of the CMD (also known as a command prompt). Which could be described as a window which allows us to delve directly into the bowels of the operating system…? Yes, it is the best description you will read of the CMD.

Many tasks can be carried out from the command prompt, some that we can even do manually from the Windows interface, but with the grace that the CMD everything is done with specific commands. Today, for example, we will explain how you can format your USB through a series of commands in the command prompt.

Why should you format your USB with CMD?

To begin with, let’s clarify why we should even consider this much more “complicated” alternative (we’ll see it later) to format our USB. But because our own computer already has another route or alternative that is much faster and more direct.

Well, to begin with, this option can be useful to solve some problems or inconveniences with the USB memory. Such is the case that the memory is write-protected, encounters some bad sectors, or is not recognized by the PC. If you have any of these problems, you should consider formatting the USB using this method.

Not only that, but this option could be considered a more “intense” format than the quick format. So it is usually good to solve the common problem in USBs when they hide residual files. Which means that sometimes our USB does not show the available capacity that it should really have?

Command to enter in the CMD.

Each of the steps to follow to format the USB memory using the CMD or Windows command prompt (7, 8, 8.1 or 10) are mentioned and explained below:

  1. The first step to take is to locate the CMD in the integrated Windows search engine. In most versions, the search bar is found by opening the menu with the operating system icon. Once in the search field, type “CMD”.
  2. Once the command prompt window appears (It’s basically a black box with white text). You are going to proceed to write the first command; “disk part” and press enter.
  3. After that, proceed to type the command “list disk” and again press enter. You will notice that in the black window there is a list with the storage units of your computer (such as hard drives). However, if your USB is properly connected, it will also be listed. You will identify it by its storage capacity.
  4. Then you must select the USB by placing the command “select disk [number]”. This number is the one that appears in the “Disk (or disk) ###” column. In the list that we saw previously, a number should have been assigned to your us memory.
  5. Type the “clean” command, and then just wait for it to finish cleaning.
  6. After finishing, type “create partition primary” and again press enter.
  7. After creating the partition (previous step), you are going to write “format fess=nets” and proceed to press enter. You can change the file format to whatever you like; there is also fat32, exact, etc.
  8. Finally, type the command “assign” to assign a letter to the USB drive. And that’s it! Pen drive formatted in its entirety.


As a last recommendation, throughout the process we recommend you read the information that the CMD provides at each step. Well, sometimes, if a command is typed wrong or a problem arises during the formatting process, the CMD itself will let us know with the text on the screen. Sometimes the system prompt is in Spanish, it all depends on the configuration of your computer.

Tanner Abraham

Data Scientist and Software Engineer with a focus on experimental projects in new budding technologies that incorporate machine learning and quantum computing into web applications.

Keep Reading