vbs判断磁盘类型和检测硬盘剩余空间的实现代码

2023-12-01 0 676

核心代码:

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

收藏 (0) 打赏

感谢您的支持,我会继续努力的!

打开微信/支付宝扫一扫,即可进行扫码打赏哦,分享从这里开始,精彩与您同在
点赞 (0)

悠久资源 VBS vbs判断磁盘类型和检测硬盘剩余空间的实现代码 https://www.u-9.cn/jiaoben/vbscript/9229.html

常见问题

相关文章

发表评论
暂无评论
官方客服团队

为您解决烦忧 - 24小时在线 专业服务