如何仅获取在线驱动器 [英] How to get only online drives

查看:67
本文介绍了如何仅获取在线驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ManagementObjectSearcher.我有以下C#代码行:

I am using the ManagementObjectSearcher.  I have the following line of C# code:

ManagementObjectSearcher driveSearcher =新的ManagementObjectSearcher(从Win32_Diskdrive中选择设备ID");

ManagementObjectSearcher driveSearcher = new ManagementObjectSearcher("SELECT DeviceID FROM Win32_Diskdrive");

但是,这将返回所有驱动器,甚至是脱机驱动器.我可以在上面添加where子句以仅返回在线驱动器吗?

However, this returns all drives even the offline drives.  Is there a where clause that I can add to the above to only return online drives?

谢谢.

推荐答案

你好,


这篇关于如何仅获取在线驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆