本文介绍了网络驱动器标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将某些网络资源的标签映射为驱动器.当我使用DriveInfo.GetDrives()时,本地卷具有预期的VolumeLabel填充参数,但是在网络驱动器中,它是一个空字符串.如何获得这些标签?

I'm trying to get the label of some network resources mapped as drives. When I use DriveInfo.GetDrives(), local volumes have the VolumeLabel filled parameter as expected, but in network drives it is an empty string. How can I get those labels?

推荐答案

您可以为此使用WMI-不确定确切的查询(已经有一段时间了),但是下面是如何获取网络驱动器可用空间的示例:

You can use WMI for this - not sure of the exact query (it's been a while), but here's an example of how to get network drive free space:

http://en.csharp-online.net/Network_Drive_Free_Space

我认为在该示例中用"VolumeName"替换"name"将满足您的需求.

I think replacing 'name' with 'VolumeName' in that example will give you what you need.

WMI参考,以防万一:

WMI reference here just in case:

http://msdn.microsoft.com/zh-cn/library/aa394173(VS.85).aspx

这篇关于网络驱动器标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-01 01:35