VB FSO 获取C盘的容量

来源:百度知道 编辑:UC知道 时间:2024/07/01 04:59:00
帮忙写下代码

Private Sub Command1_Click()
Set fso = CreateObject("Scripting.FileSystemObject")
Set drv = fso.GetDrive("c:")
MsgBox "可用空间:" & vbTab & Format(drv.freeSpace, "0,000") & " 字节" & vbCrLf & _
"总容量:" & vbTab & Format(drv.TotalSize, "0,000") & " 字节", , "驱动器 C"
End Sub