返回一個物理上的本地驅(qū)動器或者網(wǎng)絡(luò)共享的驅(qū)動器號。只讀屬性。
object.DriveLetter
其中 object 總是一個 Drive 對象。
如果所指定的驅(qū)動器沒有與一個驅(qū)動器號關(guān)聯(lián)起來,例如,一個沒有映射到驅(qū)動器號的網(wǎng)絡(luò)共享,那么 DriveLetter 屬性將返回一個長度為 0 的字符串 ("")。
下面這段代碼說明了 DriveLetter 屬性的用法:
[JScript] function ShowDriveLetter(drvPath) { var fso, d, s; fso = new ActiveXObject("Scripting.FileSystemObject"); d = fso.GetDrive(fso.GetDriveName(drvPath)); s = "Drive " +d.DriveLetter
.toUpperCase( ) + ":- "; s += d.VolumeName + "<br>"; s += "Available Space:" + d.AvailableSpace/1024 + " Kbytes"; return(s); } [VBScript] Function ShowDriveLetter(drvPath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(drvPath)) s = "Drive " &d.DriveLetter
& ":- " s = s & d.VolumeName & "<BR>" s = s & "Free Space:" & FormatNumber(d.FreeSpace/1024, 0) s = s & " Kbytes" ShowDriveLetter = s End Function
AvailableSpace 屬性 | DriveType 屬性 | FileSystem 屬性 | FreeSpace 屬性 | IsReady 屬性 | Path 屬性 | RootFolder 屬性 | SerialNumber 屬性 | ShareName 屬性 | TotalSize 屬性 | VolumeName 屬性
應(yīng)用于:Drive 對象