How to list physical disks?

CiNN picture CiNN · Nov 29, 2008 · Viewed 180.3k times · Source

How to list physical disks in Windows? In order to obtain a list of "\\\\.\PhysicalDrive0" available.

Answer

VonC picture VonC · Nov 29, 2008

WMIC

wmic is a very complete tool

wmic diskdrive list

provide a (too much) detailed list, for instance

for less info

wmic diskdrive list brief 

C

Sebastian Godelet mentions in the comments:

In C:

system("wmic diskdrive list");

As commented, you can also call the WinAPI, but... as shown in "How to obtain data from WMI using a C Application?", this is quite complex (and generally done with C++, not C).

PowerShell

Or with PowerShell:

Get-WmiObject Win32_DiskDrive