(编辑:jimmy 日期: 2024/11/10 浏览:2)
返回驱动器或网络共享的总字节数。
object.TotalSize
object 应为 Drive 对象的名称。
以下代码举例说明如何使用 TotalSize 属性:
Function ShowSpaceInfo(drvpath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(fs.GetAbsolutePathName(drvpath))) s = "
驱动器" & d.DriveLetter & ":"
s = s & vbCrLf
s = s & "
总容量:" & FormatNumber(d.TotalSize/1024, 0) & "KB"
s = s & vbCrLf
s = s & "
可用空间:" & FormatNumber(d.AvailableSpace/1024, 0) & "KB"
ShowSpaceInfo=s
End Function