返回由本地機器上所有 Drive 對象組成的 Drives 集合。
object.Drives
object 應為 FileSystemObject 對象的名稱。
無論是否插入媒體,可移動媒體驅動器都顯示在 Drives 集合中。
您可以使用 For Each...Next 結構枚舉 Drives 集合的成員,如下例所示:
Function 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 = 3 Then
n = d.ShareName
ElseIf d.IsReady Then
n = d.VolumeName
End If
s = s & n & "<BR>"
Next
ShowDriveList = s
End Function
新聞熱點
疑難解答