Visual Basic Scripting Edition | 語(yǔ)言參考 |
只讀所有可用驅(qū)動(dòng)器的集合。
無(wú)論是否插入媒體,可移動(dòng)媒體驅(qū)動(dòng)器都顯示在 Drives 集合中。
以下代碼舉例說(shuō)明如何獲得 Drives 集合并使用 For Each...Next 語(yǔ)句枚舉集合成員:
ShowDriveList
函數(shù)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 = s
End Function
Drives 集合無(wú)任何方法。
Drive 對(duì)象 | Drives 屬性 | File 對(duì)象 | Files 集合 | Folder 對(duì)象 | Folders 集合