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 红包祝福语简短10字
18 周六早晨祝福语简短