枚举连接到PC的所有硬盘驱动器 [英] Enumerate all hard drives connected to the pc

查看:101
本文介绍了枚举连接到PC的所有硬盘驱动器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我不确定如何枚举或浏览计算机上的所有硬盘驱动器。



我有2个内置硬盘和一些外置硬盘我可以看到我的组合框中的所有硬盘驱动器,但我想改变我的程序如何工作的方法。





我正在寻找一些建议,如何检测所有连接的硬盘驱动器,然后一个接一个地走过它们,直到所有硬盘驱动器从头到尾都被搜索过。





是否可以将所有硬盘驱动器返回字符串或字符串?然后如果有多个人转到下一个?....



提前谢谢

解决方案

从OS的角度来看,连接到系统的磁盘有多个方面。首先是物理设备,但也有分区,文件系统等。

以下是您可以使用WMI管理的磁盘相关任务的详尽列表: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394592(v = vs.85).aspx [ ^ ] 。样本是vbs,但它们可以很容易地转录到vb.net。在这里你有一些关于在vb.net中查询wmi的好例子: http://msdn.microsoft.com/en-us/library/ms186146(v = vs.100).aspx?cs-lang = vb [ ^ ]。

Hi there I am unsure how to go about enumerating or walking through all the hard drives on my computer.

I have 2 internal hard drives and a few external I am able to see all the hard drives in my combobox but I would like to change my approach to how my program works.


I am looking for some advice as to how to detect all connected hard drives and then walk though them one after the other until all hard drives have been searched from start to finish.


Is it possible to return all the hard drives to a string or strings? and then if there is more than one to goto the next?....

thank you in advance

解决方案

The disks connected to a system have multiple aspects from OS point of view. First of all there is the physical device, but there are also partitions, file systems and so on.
Here is a really exhaustive list of disk related tasks you can manage with WMI: http://msdn.microsoft.com/en-us/library/windows/desktop/aa394592(v=vs.85).aspx[^]. The samples are in vbs, but they can be easily transcribed to vb.net. Here you have some good examples about querying wmi in vb.net: http://msdn.microsoft.com/en-us/library/ms186146(v=vs.100).aspx?cs-lang=vb[^].


这篇关于枚举连接到PC的所有硬盘驱动器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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