I am looking for a way to list drives and the partitions on them. Specifically I am looking to prompt a user for a drive to format and I want to show them the exists partitions so they can confirm their choice.
I have found the wmic commands to list disk drives, logical disks, partitions, and volumes but I can not find a way associate the volumes to physical drives.
I also found a powershell script that does what I want. The script uses gwmi and I don't know how to convert the commands into wmic.
http://jrich523.wordpress.com/2011/12/12/using-wmi-to-link-a-disk-volume-to-a-physical-disk-with-powershell/
Is there a way to get a list of volumes on a physical disk using wmic?
Best Answer
The
wmic
command is a bit different then either the VB or Powershell syntax.The relevant syntax for
wmic
is:Specifically to solve the task above:
Will return the partitions on the drive with the given index.
Will return the volumes on the partition with the given id.