Question: I’m trying to delete a partition on a UFD using Diskpart. I am running it through an elevated CMD prompt. But the problem is it reports that I am using an invalid argument. Please see the log below.
Microsoft Windows [Version 6.3.9600](c) 2013 Microsoft Corporation. All rights reserved.C:WINDOWSsystem32>diskpartMicrosoft DiskPart version 6.3.9600Copyright (C) 1999-2013 Microsoft Corporation.On computer: SKANNING24DISKPART> list disk ?Disk ### ?Status ?Size ?Free ?Dyn ?Gpt ?——– ?————- ?——- ?——- ?— ?— ?Disk 0 ?Online ?465 GB ?1024 KB ?* ?Disk 1 ?Online ?3819 MB ?3670 MB ?*DISKPART> select disk 1Disk 1 is now the selected disk.DISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——- ?Partition 1 ?Primary ?49 MB ?64 KB ?Partition 2 ?System ?98 MB ?51 MBDISKPART> select partition 1Partition 1 is now the selected partition.DISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——-* Partition 1 ?Primary ?49 MB ?64 KB ?Partition 2 ?System ?98 MB ?51 MBDISKPART> deleteMicrosoft DiskPart version 6.3.9600DISK ?- Delete a missing disk from the disk list.PARTITION ?- Delete the selected partition.VOLUME ?- Delete the selected volume.DISKPART> delete partition 1The arguments specified for this command are not valid.For more information on the command type: HELP DELETE PARTITIONDISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——-* Partition 1 ?Primary ?49 MB ?64 KB ?Partition 2 ?System ?98 MB ?51 MBDISKPART> select partition 2Partition 2 is now the selected partition.DISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——- ?Partition 1 ?Primary ?49 MB ?64 KB* Partition 2 ?System ?98 MB ?51 MBDISKPART> delete partition 2The arguments specified for this command are not valid.For more information on the command type: HELP DELETE PARTITIONDISKPART> help delete partition ?Deletes the partition with focus.Syntax: ?DELETE PARTITION [NOERR] [OVERRIDE] ?NOERR ?For scripting only. When an error is encountered, DiskPart ?continues to process commands as if the error did not occur. ?Without the NOERR parameter, an error causes DiskPart to exit ?with an error code. ?OVERRIDE ?Enables DiskPart to delete any partition regardless of type. ?Typically, DiskPart only permits you to delete known data ?partitions. ?You cannot delete the system partition, boot partition, or any partition ?that contains the active paging file or crash dump (memory dump) filed. ?A partition must be selected for this operation to succeed. ?Partitions cannot be deleted from dynamic disks or created on dynamic ?disks.Example: ?DELETE PARTITIONDISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——- ?Partition 1 ?Primary ?49 MB ?64 KB* Partition 2 ?System ?98 MB ?51 MBDISKPART> delete partition 2 overrideThe arguments specified for this command are not valid.For more information on the command type: HELP DELETE PARTITIONDISKPART>
Q: What is the “argument” in this case? And why is it not valid?
This is not the first time that I’m using Diskpart, I have used it several times before whenever there were special hidden recovery partitions on a disk drive that could not be removed with conventional disk tools like Diskmgmt.msc. So I’m pretty sure I got the syntax right and I am doing everything according to the help pages.
I am working on Windows 8.1 and the UFD is a SanDisk Cruzer Blade 4 GB, brand new. I only had PassMark Memtest86 installed on it and that’s about all I ever used it for. I have formatted the UFD today to remove Memtest86 from it (quick format in Explorer), but a hidden EFI partition was left on the UFD. See screenshot below.
Answer: Invalid argument! I got it now.
There’s no need to append the command with the partition number when the partition is already selected.
Instead of:
select partition 2delete partition 2 override
Use this:
select partition 2delete partition override
As simple as that…
Microsoft Windows [Version 6.2.9200](c) 2012 Microsoft Corporation. Med ensamr?tt.C:Windowssystem32>diskpartMicrosoft DiskPart version 6.2.9200Copyright (C) 1999-2012 Microsoft Corporation.On computer: SKANNING26DISKPART> list disk ?Disk ### ?Status ?Size ?Free ?Dyn ?Gpt ?——– ?————- ?——- ?——- ?— ?— ?Disk 0 ?Online ?698 GB ?0 B ?* ?Disk 1 ?Online ?3819 MB ?3670 MB ?*DISKPART> select disk 1Disk 1 is now the selected disk.DISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——- ?Partition 1 ?Primary ?49 MB ?64 KB ?Partition 2 ?System ?98 MB ?51 MBDISKPART> select partition 1Partition 1 is now the selected partition.DISKPART> delete partition 1The arguments specified for this command are not valid.For more information on the command type: HELP DELETE PARTITIONDISKPART> delete partitionDiskPart successfully deleted the selected partition.DISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——- ?Partition 2 ?System ?98 MB ?51 MBDISKPART> select partition 2Partition 2 is now the selected partition.DISKPART> delete partitionVirtual Disk Service error:Det g?r inte att ta bort en skyddad partition utan att parametern Tvinga skyddad har angetts.DISKPART> list partition ?Partition ### ?Type ?Size ?Offset ?————- ?—————- ?——- ?——-* Partition 2 ?System ?98 MB ?51 MBDISKPART> delete partition overrideDiskPart successfully deleted the selected partition.DISKPART> list partitionThere are no partitions on this disk to show.DISKPART>