推荐于2016-04-13
展开全部
Function ShowDriveType(drvpath)'判断磁盘类型
Dim fso, d, t
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvpath))
Select Case d.DriveType
Case 0
t = "Unknown(未知)"
Case 1
t = "Removable(移动硬盘)"
Case 2
t = "Fixed(硬盘)"
Case 3
t = "Network(网络硬盘)"
Case 4
t = "CD-ROM(只读光盘)"
Case 5
t = "RAM Disk(虚拟内存盘)"
End Select
ShowDriveType = t
End Function
Function ShowFreeSpace(drvPath) '检测剩余空间
Dim fso, d, s
Set fso = CreateObject("Scripting.FileSystemObject")
Set d = fso.GetDrive(fso.GetDriveName(drvPath)) 'd为F:
s = FormatNumber(d.FreeSpace/1024, 0)
ShowFreeSpace = s
End Function
MsgBox "剩余空间 " & ShowFreeSpace("F:\Programming\Applications") & " KBytes"
MsgBox "剩余空间 " & ShowFreeSpace("c:") & " KBytes"
MsgBox "类型为"+ShowDriveType("f:")
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询