从硬盘卷中获取驱动器号 [英] Get drive letter from harddiskvolume#

查看:177
本文介绍了从硬盘卷中获取驱动器号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在字符串="\ device \ harddiskvolume2 \ program files \ kaspersky lab \ kaspersky internet security 2012 \ avp.exe"中具有这样的应用程序路径

I have path of an application like this in a string = "\device\harddiskvolume2\program files\kaspersky lab\kaspersky internet security 2012\avp.exe"

在此示例中,我需要将\ device \ harddiskvolume2转换为相应的驱动器号c:/

I need to convert \device\harddiskvolume2 to the respective drive letter in this example c:/

我正在寻找一个功能,该功能实际上根据硬盘卷号给出驱动器号.一个简单的字符串替换是不够的,因为该应用程序将在许多不同的计算机上运行,​​并且驱动器号可能会有所不同,因此实际功能 从硬盘卷号中获取驱动器号是我要寻找的.

I am looking for a function which actually gives the drive letter based on the harddiskvolume number. A simple string replace would not suffice as the application will run on many different computers and the drive letter may differ so an actual function to get the drive letter from the harddiskvolume number is what I am looking for.

推荐答案

您必须使用WMI

http://www.geekpedia.com/tutorial233_Getting-Disk -Drive-Information-using-WMI-and-Csharp.html

http://bytes.com /topic/c-sharp/answers/272971-wmi-hard-drive-physical-location-drive-letter-问题

RegARDS

sTYGEN


这篇关于从硬盘卷中获取驱动器号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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