How to list physical disks?

#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

Update Feb. 2022, Microsoft announces in “Windows 10 features we’re no longer developing

The WMIC tool is deprecated in Windows 10, version 21H1 and the 21H1 General Availability Channel release of Windows Server.

This tool is superseded by Windows PowerShell for WMI.

Note: This deprecation only applies to the command-line management tool. WMI itself is not affected.

Leave a Comment