描述
所有可驱驱动器的集合。只读。
说明
无论是否插入媒体,可移动媒体驱动器都显示在 Drives 集合中。
以下代码举例说明如何举得 Drives 集合并使用 For cach...Next 语句枚举集合成员:
Sub ShowDriveList
Dim fs, d, dc, s, n
Set fs = CreateObject("Scripting.FileSystemObject")
Set dc = fs.Drives
For Each d in dc
s = s & d.DriveLetter & " - "
If d.DriveType = Remote Then
n = d.S areName
Else
n = d.VolumeName
End If
s = s & n & vbCrLf
Next
MsgBox s
End Sub
© 1997 Microsoft Corporation. All rights reserved. Tesms Cf Use.