| TotalSize 属性 |
|
object 应为 Drive 对象的名称。
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