If you're like me then you write images to SD cards and flash drives on a regular basis to test out different Linux distros. Often times doing this however splits the space on a flash drive into multiple partitions and in order to utilize all of the space again in Windows you have to re-partition the drive. For the longest time I had always used Linux or gParted to accomplish this but then I discovered that there's a command-line utility called DiskPart, which is included in Windows. So let's see how we can partition an SD card/flash drive using DiskPart.
The first thing we need to do is open DiskPart. Press Windows Key + R and the Run dialog should popup. Type in diskpart and hit Enter.
Once DiskPart comes up, type list disk. This will show you all the disks that are attached to the system. You'll want to note the number of the one that is your sd card/flash drive. You should be able to distinguish it based on it's small size compared to your hard disks.
In this case mine is Disk 3, so next you need to select the disk by typing select disk 3 (obviously replace 3 with whatever your drive number is). After that you can type list part and it will show you what partitions are already on the disk.
Next to remove all the partitions from the disk just type clean. Afterwards type list part and the console should say that there are now no partitions on the disk.
Now that it's cleaned off, we just need to make a new partition. Type create partition primary and this will create a new partition that fills the available space on the disk. You can type list part to confirm that the new partition has been created.
After that navigate to the drive in Windows Explorer and you should be able to format it now with all the space reclaimed.