Download Article
A step-by-step guide to use the Command Prompt to reformat and clean a flash drive
Download Article

If you're getting errors when trying to format your USB flash drive in Windows File Explorer (such as "Windows was unable to complete the format"), you can still format the drive using the Command Prompt. This How.com.vn article will teach you how to erase and reformat your flash drive using the DiskPart tool in CMD using your Windows computer or laptop.

Things You Should Know

  • Plug the USB into your computer, then run CMD as Administrator.
  • After using the commands "diskpart", "list disk", and "select disk", type "clean" and press "Enter".
  • Use the command "create partition primary" to further format your USB drive.
  1. How.com.vn English: Step 1 Plug your USB...
    Plug your USB drive into your computer. Plug it into one of the various USB ports on your computer to continue.
    • Normally, you'd format a USB drive by right-clicking it and selecting Format from the menu. You'll only use Command Prompt if that other method does not work.
    • You can also use this method if you can't see the USB drive in File Explorer.
  2. How.com.vn English: Step 2 Open Command Prompt...
    Open Command Prompt as an administrator. To do this, press the Win key on your keyboard and type "cmd" to search for the program.[1]
    • Click Run as Administrator from the results list that appears.
    Advertisement
  3. Step 3 Type "diskpart" and press ↵ Enter.
    You'll see some feedback about your computer and initiates the DiskPart utility.[2]
  4. Step 4 Type "list disk" and press ↵ Enter.
    In the list, you should be able to determine which listed disk is your USB.[3]
  5. Step 5 Type "select disk [Your disk]" and press ↵ Enter.
    From the disk list, you'll need to replace the [Your disk] line with your disk number.[4]
    • For example, if your USB is located in disk 2, you'd enter "select disk 2."
    • Once the command is accepted, you'll see "[Your disk] is now the selected disk."
  6. Step 6 Type "clean" and press ↵ Enter.
    Wait a little bit while Command Prompt formats your USB drive.[5]
    • You'll see "DiskPart succeeded in cleaning the disk" when it's finished.
  7. Step 7 Type "create partition primary" and press ↵ Enter.
    You'll need to do this before you can further format your USB drive.[6]
    • Command Prompt will display "DiskPart succeeded in creating the specified partition" when it's done.
  8. Step 8 Type "format fs=ntfs" and press ↵ Enter.
    This command will tell your USB drive to format with ntfs format. You can also use fat32 or exfat instead by replacing "ntfs" in the command.[7]
    • You'll see "DiskPart successfully formatted the volume" when it's finished.
  9. 9
    Type "assign letter=[letter]" and press Enter. This command will assign a specific letter to your drive.[8]
    • In place of [letter], enter a single letter. For example, you'd enter "assign letter=h".
  10. Step 10 Type "exit" and press Enter.
    This will exit the DiskPart program so you can continue using the USB drive to save files or disconnect it from your computer.[9]
  11. Advertisement



Expert Q&A

Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
      Advertisement

      Video

      Tips

      Submit a Tip
      All tip submissions are carefully reviewed before being published
      Thanks for submitting a tip for review!

      About This Article

      How.com.vn English: Rain Kengly
      Written by:
      How.com.vn Technology Writer
      This article was co-authored by How.com.vn staff writer, Rain Kengly. Rain Kengly is a How.com.vn Technology Writer. As a storytelling enthusiast with a penchant for technology, they hope to create long-lasting connections with readers from all around the globe. Rain graduated from San Francisco State University with a BA in Cinema. This article has been viewed 479,982 times.
      How helpful is this?
      Co-authors: 6
      Updated: November 10, 2023
      Views: 479,982
      Categories: Command Prompt
      Article SummaryX

      1. Plug your USB drive into your computer.
      2. Open Command Prompt as an administrator.
      3. Type "diskpart" and press Enter.
      4. Type "list disk" and press Enter.
      5. Type "select disk [Your disk]" and press Enter.
      6. Type "clean" and press Enter.
      7. Type "create partition primary" and press Enter.
      8. Type "format fs=ntfs" and press Enter.
      9. Type "exit" and press Enter.

      Did this summary help you?

      Thanks to all authors for creating a page that has been read 479,982 times.

      Is this article up to date?

      ⚠️ Disclaimer:

      Content from Wiki How English language website. Text is available under the Creative Commons Attribution-Share Alike License; additional terms may apply.
      Wiki How does not encourage the violation of any laws, and cannot be responsible for any violations of such laws, should you link to this domain, or use, reproduce, or republish the information contained herein.

      Notices:
      • - A few of these subjects are frequently censored by educational, governmental, corporate, parental and other filtering schemes.
      • - Some articles may contain names, images, artworks or descriptions of events that some cultures restrict access to
      • - Please note: Wiki How does not give you opinion about the law, or advice about medical. If you need specific advice (for example, medical, legal, financial or risk management), please seek a professional who is licensed or knowledgeable in that area.
      • - Readers should not judge the importance of topics based on their coverage on Wiki How, nor think a topic is important just because it is the subject of a Wiki article.

      Advertisement