以字节为单位返回驱动器或网络共享的所有空间大小。
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 对象