Open up the Start Menu and type “diskpart” in the run box. Press enter. You’ll be prompted by the Windows UAC to authorize admin access to the DISKPART tool.
A command-prompt-like window will open up, only the prompt will say “DISKPART”. At that prompt, type “list disk”.
In the list output on our machine you can see the computer’s hard drive (119GB) and the removable SD card (14GB). It is absolutely critical you note the proper disk number. DISKPART commands are immediate and without any warning. If you type in the wrong disk number, you’re going to have a really bad time.
After identifying your SD card’s disk number, enter the following command “select disk #” where # is the disk number of your SD card.
Whatever commands you execute after this point will only make changes to the selected disk; now would be a good time to double check you’ve selected the right disk just to be extra safe.
Next, now enter the command “clean”
The clean command zeroes out the sectors of the disk that contain the partition data. If you wished to zero out all data on the SD card you could use “clean all” instead, but unless you have a pressing privacy/security reason for overwriting the the entire SD card with zeros, it’s unwise to waste the read/write cycles of the flash media.
After cleaning the disk, enter the following command “create partition primary”
The command, as the syntax implies, creates a new partition on the disk and sets it to primary. After creating the primary partition, the entire storage capacity of the SD card should be available to Windows. If we peek back into Disk Manager, we no longer see a tiny partition with a huge hunk of unallocated space, but a large partition ready to be formatted:
That’s all there is to it! A little DISKPART wizardy and the SD card is factory fresh again.
- extract of article from here