搜索 SD 卡
我需要在我的程序中实现对 SD 卡的搜索。
目前我正在使用搜索所有可移动设备,例如:
searcher = New Management.ManagementObjectSearcher("\\localhost\root\cimv2", "SELECT DeviceId FROM Win32_LogicalDisk WHERE DriveType=2 AND Size>0");
但它也找到 USB 闪存驱动器。有没有正确的方法只找到SD卡? 我通常需要的只是可用 SD 卡的驱动器号(如“F:”等)。
I need to implement searching for SD-cards in my program.
Currently I'm using search for all removable devices like:
searcher = New Management.ManagementObjectSearcher("\\localhost\root\cimv2", "SELECT DeviceId FROM Win32_LogicalDisk WHERE DriveType=2 AND Size>0");
But it find USB flash drives also. Is there a proper way to find SD-cards only?
What I need is in general only drive letter for available SD-cards (like "F:" or so).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
SD 卡具有唯一的 ID。 USB 存储器不是。所以你可以用它来区分USB和SD卡。我已经在 windows ce 中使用它并且工作正常。
The SD cards use to have an unique ID. USB memories not. So you can use that to distinguish from USB and the SD card. I have used it in windows ce and was working properly.
我认为这是不可能的 - Windows 无法区分读卡器中的 SD 卡和 USB 记忆棒。事实上,我敢打赌,现在大多数情况下它们实际上是同一件事(即记忆棒 = USB 插头上的 SD 卡)。
I don't think this is possible - Windows doesn't distinguish an SD card in a card reader from a USB stick. In fact I'd bet that in most cases these days they're actually the same thing (i.e. memory stick = SD-card-on-a-USB-plug).