1

How can i get the UNC path of the partitions on my hard disk in Windows 7? I mean paths to be displayed in this way:

\Device\Harddisk0\Partition1
\Device\Harddisk0\Partition2
\Device\Harddisk0\Partition3

Is it possible to do that from Command Prompt?

1

1 Answer 1

1

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).

1
  • Diskpart doesn't list the partitions with their NT paths, and if i try to use powershell it says that it doesn't recognize the term Get-Partition.
    – peter7558
    Jan 2, 2015 at 15:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .