Formatting a USB Drive can be pretty straightforward. You plug in the USB drive and find it Windows File Explorer, and right-click > Format. While do this via GUI is simple and easy, if you want to repeat this for several USBs or automate this action, you probably want to do that via the command line to run as a batch script.
Today we will go over how to format USB drive via the command line.
Type “DISKPART” and Hit Enter, from the diskpart prompt, type “list disk” and hit enter. This should give you something look like below.
Microsoft DiskPart version 10.0.21364.1 Copyright (C) Microsoft Corporation. On computer: AMDRYZEN3 DISKPART> list disk Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 3726 GB 0 B * Disk 1 Online 931 GB 0 B Disk 2 Online 232 GB 0 B * Disk 3 Online 14 GB 3072 KB Disk 4 Online 14 GB 0 B DISKPART>
1. Select disk x (x represents your USB drive)*
For the example here my disk is #4, it should look something like below.
DISKPART> select disk 4 Disk 4 is now the selected disk. DISKPART>
2. Clean > Enter
3. Create partition primary > Enter
4. Active > Enter
5. Format fs=ntfs > Enter
6. Exit > Enter
It should look something like below. Note here I chose to format in NTFS you may use format such as FAT32 etc.
DISKPART> Clean DiskPart succeeded in cleaning the disk. DISKPART> Create partition primary DiskPart succeeded in creating the specified partition. DISKPART> active DiskPart marked the current partition as active. DISKPART> format fs=ntfs 90 percent completed
This is the walk through on how to format USB drive via command line.