Diskpart.exe Windows Disk Command Line Tool

The diskpart command starts diskpart.exe, a command line interface to disk partitoning tools. The tool allows creating, reparing and breaking a mirror, marking a partiton active, assigning drive letters, volume control including create and extending, deleting an object and gathering information.

‘diskpart list’ as a command will display a list of objects. ‘diskpart rescan’ will rescan for disks and objects. The ‘select’ command allows the utility to explicitly set the focus on a target – commands are then aimed at the active target. The ‘detail’ command provides details for disks, partitions or volumes.

Most of these functions are available through the computer management-> disk management GUI. The diskpart command is scriptable however, which allows using diskpart commands in deployment scenarios.

Example: Get the details of a partition from a selected disk

list disk
select disk 0
list partition
select partition 1
detail partition