Microsoft(R) Visual Basic(R) Scripting Edition
Drives 集合
语言参考
起始页 | 版本 3

请参阅                   属性                   方法


描述
所有可用驱动器的集合。只读。
说明
无论是否插入媒体,可移动媒体驱动器都显示在 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
        s = s & d.DriveLetter & " - " 
        If d.DriveType = Remote Then
            n = d.ShareName
        ElseIf d.IsReady Then
            n = d.VolumeName
        End If
        s = s & n & 
    Next
   ShowDriveList = s
End Function

(C) 1998 Microsoft Corporation. All rights reserved. Terms of Use.