2个回答
展开全部
高级代码! 至宝
'引用 Microsoft Scripting Runtime
Dim fso As New FileSystemObject, drv As Drive
Set drv = fso.GetDrive(fso.GetDriveName("c:"))
Print "剩余空间大小:" & drv.FreeSpace / 1024 / 1024
Print "磁盘大小:" & drv.TotalSize / 1024 / 1024
'引用 Microsoft Scripting Runtime
Dim fso As New FileSystemObject, drv As Drive
Set drv = fso.GetDrive(fso.GetDriveName("c:"))
Print "剩余空间大小:" & drv.FreeSpace / 1024 / 1024
Print "磁盘大小:" & drv.TotalSize / 1024 / 1024
展开全部
'引用 Microsoft Scripting Runtime
Dim x As New Scripting.FileSystemObject
Dim y As Scripting.Drive
For Each y In x.Drives
Debug.Print y.DriveType
If y.DriveType = Fixed Then
Debug.Print "AvailableSpace: " & y.AvailableSpace / 1024 / 1024 & " MBytes"
Debug.Print "DriveLetter: " & y.DriveLetter
Debug.Print "DriveType: " & y.DriveType
Debug.Print "FileSystem: " & y.FileSystem
Debug.Print "FreeSpace: " & y.FreeSpace / 1024 / 1024 & " MBytes"
Debug.Print "IsReady: " & y.IsReady
Debug.Print "Path: " & y.Path
Debug.Print "RootFolder: " & y.RootFolder
Debug.Print "SerialNumber: " & y.SerialNumber
Debug.Print "ShareName: " & y.ShareName
Debug.Print "TotalSize: " & y.TotalSize / 1024 / 1024 & " MBytes"
Debug.Print "VolumeName: " & y.VolumeName
End If
Next
Dim x As New Scripting.FileSystemObject
Dim y As Scripting.Drive
For Each y In x.Drives
Debug.Print y.DriveType
If y.DriveType = Fixed Then
Debug.Print "AvailableSpace: " & y.AvailableSpace / 1024 / 1024 & " MBytes"
Debug.Print "DriveLetter: " & y.DriveLetter
Debug.Print "DriveType: " & y.DriveType
Debug.Print "FileSystem: " & y.FileSystem
Debug.Print "FreeSpace: " & y.FreeSpace / 1024 / 1024 & " MBytes"
Debug.Print "IsReady: " & y.IsReady
Debug.Print "Path: " & y.Path
Debug.Print "RootFolder: " & y.RootFolder
Debug.Print "SerialNumber: " & y.SerialNumber
Debug.Print "ShareName: " & y.ShareName
Debug.Print "TotalSize: " & y.TotalSize / 1024 / 1024 & " MBytes"
Debug.Print "VolumeName: " & y.VolumeName
End If
Next
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询