返回一個(gè)物理上的本地驅(qū)動(dòng)器或者網(wǎng)絡(luò)共享的驅(qū)動(dòng)器號(hào)。只讀屬性。
object.DriveLetter
其中 object 總是一個(gè) Drive 對(duì)象。
如果所指定的驅(qū)動(dòng)器沒(méi)有與一個(gè)驅(qū)動(dòng)器號(hào)關(guān)聯(lián)起來(lái),例如,一個(gè)沒(méi)有映射到驅(qū)動(dòng)器號(hào)的網(wǎng)絡(luò)共享,那么 DriveLetter 屬性將返回一個(gè)長(zhǎng)度為 0 的字符串 ("")。
下面這段代碼說(shuō)明了 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 對(duì)象