如何确定给定驱动器号是本地驱动器、映射驱动器还是 USB 驱动器?
给定驱动器盘符,我如何确定它是什么类型的驱动器?
例如,E:\ 是 USB 驱动器、网络驱动器还是本地硬盘驱动器。
Given the letter of a drive, how can I determine what type of drive it is?
For example, whether E:\ is a USB drive, a network drive or a local hard drive.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
查看
DriveInfo
< /a> 的DriveType
财产。Have a look at
DriveInfo
'sDriveType
property.仅供其他人参考,这就是我将 GenericTypeTea 的答案转变为:(
您可能还需要注意 AJBauer 的 答案 :DriveInfo 还将 USB HD 列为 DriveType.fixed)
Just for reference for anyone else, this is what I turned GenericTypeTea's answer into:
(You might want also take note of A.J.Bauer's answer: DriveInfo will also list USB HDs as DriveType.fixed)
DriveInfo 还会将 USB HD 列为 DriveType.fixed,因此如果您需要知道驱动器的接口是否为 USB,这并没有帮助。下面是一个返回所有外部 USB 驱动器号的 VB.NET 函数:
请参阅此 MSDN 链接:
WMI 任务:磁盘和文件系统
DriveInfo will also list USB HDs as DriveType.fixed, so this doesn't help if you need to know if a drive's interface is USB or not. Here is a VB.NET function that returns all external USB drive letters:
See this MSDN link:
WMI Tasks: Disks and File Systems
DriveType 将 SUBSTed 驱动器显示为
DriveType.Fixed
。QueryDosDevice
可用于获取数据这是一个完整的解决方案:如何确定目录路径是否为 SUBST 'd。
DriveType shows SUBSTed drives also as
DriveType.Fixed
.QueryDosDevice
can be used to get the dataHere is a complete solution: How to determine if a directory path was SUBST'd.
查看 DriveInfo 和 驱动器类型
Have a look at DriveInfo and DriveType