以字節(jié)為單位返回驅動器或網(wǎng)絡共享的所有空間大小。
object.TotalSize
object 總是為 Drive 對象。
下面的代碼說明了 TotalSize 屬性的用法:
[JScript] function SpaceReport(drvPath) { var fso, d, s; fso = new ActiveXObject("Scripting.FileSystemObject"); d = fso.GetDrive(fso.GetDriveName(drvPath)); s = "Drive " + drvPath + " - "; s += d.VolumeName + "<br>"; s += "Total Space:"+d.TotalSize
/1024 + " Kbytes <br>"; s += "Free Space: " + d.FreeSpace/1024 + " Kbytes"; return(s); } [VBScript] Function ShowSpaceInfo(drvpath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath))) s = "Drive " & d.DriveLetter & ":" s = s & vbCrLf s = s & "Total Size:" & FormatNumber(d.TotalSize
/1024, 0) & " Kbytes" s = s & vbCrLf s = s & "Available:" & FormatNumber(d.AvailableSpace/1024, 0) & " Kbytes" ShowSpaceInfo = s End Function
AvailableSpace 屬性 | DriveLetter 屬性 | DriveType 屬性 | FileSystem 屬性 | FreeSpace 屬性 | IsReady 屬性 | Path 屬性 | RootFolder 屬性 | SerialNumber 屬性 | ShareName 屬性 | VolumeName 屬性
應用于:Drive 對象