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 送给学长毕业祝福语简短