Windows – DiskPart to Clean and Format a Flash Drive

Use the Windows key + X keyboard shortcut to open the Power User menu and select Command Prompt (Admin).

Connect the drive you want clean and format to your computer.

Type the following command and press Enter:

diskpart

Type the following command to list all the available drives and press Enter:

list disk

Take your time and very carefully, on the output from the previous command, identify the drive you want to clean.

For example, you will see multiple drives listed, including Disk 0, which is usually the “C” boot drive and it’s the primary system drive. And because you’re trying to clean a smaller flash drive, you can easily spot that Disk 3,4,5,etc. is the drive you need to select.

Use the following command to select the drive and press Enter:

select disk 3 (or the appropriate disk number)

Remember to change 3 in the command with the number of the drive you want to clean. If you fail to choose the correct number it will erase all the data from the wrong drive.

Type the following command to clean the drive and press Enter:

clean

Type the following command to double-check the drive still selected and press Enter:

list disk

If the drive still selected, you will notice an asterisk (*) next to the disk.

Type the following command to create a partition and press Enter:

create partition primary

Type the following command to select the partition you just created and press Enter:

select partition 1

Type the following command to set the partition active and press Enter:

active

Type the following command to format the partition using NTFS and to set a label, and press Enter:

format FS=NTFS label=WC-Drive quick

Remember to change the WC-Drive in the command with the drive name you want to use.

Type the following command to assign a drive letter and press Enter:

assign letter=W

Remember to change W in the command with a letter you want that isn’t in use by another drive on This PC.