VBS教程:对象-Drives 集合

时间:2021-05-23

Drives 集合

只读所有可用驱动器的集合。

说明

无论是否插入媒体,可移动媒体驱动器都显示在 Drives 集合中。

以下代码举例说明如何获得 Drives 集合并使用 For Each...Next 语句枚举集合成员:

ShowDriveList 函数 Dim fso, d, dc, s, n Set fso = CreateObject("Scripting.FileSystemObject") Set dc = fso.Drives For Each d in dc n = "" s = s & d.DriveLetter & " - " If d.DriveType = Remote Then n = d.ShareName ElseIf d.IsReady Then n = d.VolumeName End If s = s & n &"<BR>" Next ShowDriveList = sEnd Function

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章