vbs判断磁盘类型和检测硬盘剩余空间的实现代码_vbs教程-查字典教程网
vbs判断磁盘类型和检测硬盘剩余空间的实现代码
vbs判断磁盘类型和检测硬盘剩余空间的实现代码
发布时间:2016-12-28 来源:查字典编辑
摘要:核心代码:FunctionShowDriveType(drvpath)Dimfso,d,tSetfso=CreateObject("Scri...

核心代码:

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" 'RAM End Select ShowDriveType = "Drive " & d.DriveLetter & ": - " & 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 = "Drive " & UCase(drvPath) & " - " s = s & d.VolumeName & " " s = s & "Free Space: " & FormatNumber(d.FreeSpace/1024, 0) s = s & " KBytes" ShowFreeSpace = s End Function Dim message message = ShowDriveType("F:ProgrammingApplications") MsgBox message message = ShowFreeSpace("F:ProgrammingApplications") MsgBox message

相关阅读
推荐文章
猜你喜欢
附近的人在看
推荐阅读
拓展阅读
  • 大家都在看
  • 小编推荐
  • 猜你喜欢
  • 最新vbs学习
    热门vbs学习
    脚本专栏子分类