windows 通过wmi获取硬盘以及所有分区


第一步:

select * from Win32_DiskDrive

第二步:
Associators of {Win32_DiskDrive.DeviceID='\\.\PHYSICALDRIVE0'} where AssocClass=Win32_DiskDriveToDiskPartition

第三步:
Associators of {Win32_DiskPartition.DeviceID='Disk #0, Partition #1'} where AssocClass=Win32_LogicalDiskToPartition

总结自MSDN: https://docs.microsoft.com/zh-cn/windows/win32/cimwin32prov/win32-logicaldisktopartition?redirectedfrom=MSDN


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM