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