You can create script for diskpart
.
Example script ListPartition.txt
:
select disk 0
list partition
Than execute this script with diskpart.exe -s ListPartition.txt
.
If you can use PowerShell it is even easier. Use Get-Partition
.
Get-Partition
For exact output you wished you can use next script:
Get-Partition -DiskNumber 0 | ForEach-Object {"\Device\Harddisk$($_.DiskNumber)\Partition$($_.PartitionNumber)"}
You can also execute powershell directly from cmd with:
powershell -Command "Get-Partition -DiskNumber 0 | ForEach-Object {\"\Device\Harddisk$($_.DiskNumber)\Partition$($_.PartitionNumber)\"}"
Note the escaped "
with \"
All these commands must be execured with elevated priviletges (Run as Administrator).