Really useful if you have a USB Stick which have been used for installing Debian or another Linux and you wish to use it for something on Windows, the graphical partition manager in Windows are way to retarded to do this, but luckily there’s a CLI tool who can do it:
C:\Users\mike> diskpart
Now windows will show a popup asking for permissions to run this tool with administrator privileges, after you granted this you will be in a “DISKPART” prompt, now do this:
Microsoft DiskPart version 10.0.19041.3636
Copyright (C) Microsoft Corporation.
On computer: OFFICEPC
DISKPART> list disk
Disk ### Status Size Free Dyn Gpt
-------- ------------- ------- ------- --- ---
Disk 0 Online 111 GB 1024 KB
Disk 1 Online 28 GB 1024 KB
DISKPART> select disk 1
Disk 1 is now the selected disk.
DISKPART> list partition
Partition ### Type Size Offset
------------- ---------------- ------- -------
Partition 1 Primary 1 GB 1024 KB
Partition 2 Primary 27 GB 1 KB
DISKPART> select partition 1
Partition 1 is now the selected partition.
DISKPART> delete partition
DiskPart successfully deleted the selected partition.
DISKPART> exit
You obviously need to repeat this for all the partitions you need to delete.
More info: https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/diskpart