描述
返回驅動器或網路共享的總位元組數。語法
object.TotalSizeobject應為 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