核心代码:
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:\Programming\Applications") MsgBox message message = ShowFreeSpace("F:\Programming\Applications") MsgBox message
标签:
vbs,磁盘类型,硬盘剩余空间
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
内蒙古资源网 Copyright www.nmgbbs.com
暂无“vbs判断磁盘类型和检测硬盘剩余空间的实现代码”评论...