vbs判断磁盘类型和检测硬盘剩余空间的实现代码
核心代码:
FunctionShowDriveType(drvpath)
Dimfso,d,t
Setfso=CreateObject("Scripting.FileSystemObject")
Setd=fso.GetDrive(fso.GetDriveName(drvpath))
SelectCased.DriveType
Case0t="Unknown"
Case1t="Removable"'移动硬盘
Case2t="Fixed"'硬盘
Case3t="Network"'网络硬盘
Case4t="CD-ROM"
Case5t="RAMDisk"'RAM
EndSelect
ShowDriveType="Drive"&d.DriveLetter&":-"&t
EndFunction
FunctionShowFreeSpace(drvPath)
Dimfso,d,s
Setfso=CreateObject("Scripting.FileSystemObject")
Setd=fso.GetDrive(fso.GetDriveName(drvPath))'d为F:
s="Drive"&UCase(drvPath)&"-"
s=s&d.VolumeName&""
s=s&"FreeSpace:"&FormatNumber(d.FreeSpace/1024,0)
s=s&"KBytes"
ShowFreeSpace=s
EndFunction
Dimmessage
message=ShowDriveType("F:\Programming\Applications")
MsgBoxmessage
message=ShowFreeSpace("F:\Programming\Applications")
MsgBoxmessage热门推荐
10 小红书平安祝福语简短
11 生日祝福语大全女孩简短
12 收生日红包祝福语 简短
13 领证幽默祝福语简短
14 法考面试祝福语简短
15 老哥出门祝福语简短语
16 送灯祝福语简短独特
17 幼儿狗年祝福语大全简短
18 好听的元旦简短祝福语