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 新房祝福语简短10字
14 长辈新年祝福语大全简短
15 新年给大家简短祝福语
16 生日祝福语简短独特姑姑
17 芭比的婚礼祝福语简短
18 邀请新人祝福语简短英文