描述
返回驱动器或网络共享的总字节数。
语法
object.TotalSize
object 应为 Drive 对象的名称。
说明
以下代码举例说明如何使用 TotalSize 属性:
Sub ShowSpaceInfo(drvpath)
Dim fs, d, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set d = fs.GetDrive(fs.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"
MsgBox s
End Sub