提供對(duì)特定磁盤驅(qū)動(dòng)器或網(wǎng)絡(luò)共享屬性的訪問。
下面的代碼演示了如何用 Drive 對(duì)象訪問驅(qū)動(dòng)器屬性:
[JScript] function ShowFreeSpace(drvPath) { var fso, d, s; fso = new ActiveXObject("Scripting.FileSystemObject"); d =fso.GetDrive(
fso.GetDriveName(drvPath))
; s = "Drive " + drvPath + " - " ; s += d.VolumeName + "<br>"; s += "Free Space: " + d.FreeSpace/1024 + " Kbytes"; return(s); } [VBScript] Function ShowFreeSpace(drvPath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d =fso.GetDrive(
fso.GetDriveName(drvPath))
s = "Drive " & UCase(drvPath) & " - " s = s & d.VolumeName & "<BR>" s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0) s = s & " Kbytes" ShowFreeSpace = s End Function
Drive 對(duì)象沒有方法。
AvailableSpace 屬性 | DriveLetter 屬性 | DriveType 屬性 | FileSystem 屬性 | FreeSpace 屬性 | IsReady 屬性 | Path 屬性 | RootFolder 屬性 | SerialNumber 屬性 | ShareName 屬性 | TotalSize 屬性 | VolumeName 屬性
Drives 集合 | File 對(duì)象 | Files 集合 | Folder 對(duì)象 | Folders 集合 | GetDrive 方法