设置或返回指定驱动器的卷名。读/写。
object.VolumeName [= newname]
下面的代码说明了 VolumeName 属性的用法:
[JScript] function SpaceReport(drvPath) { var fso, d, s; fso = new ActiveXObject("Scripting.FileSystemObject"); d = fso.GetDrive(fso.GetDriveName(drvPath)); s = "Drive " + drvPath + " - "; s +=d.VolumeName
+ "<br>"; s += "Total Space:"+ d.TotalSize/1024 + " Kbytes <br>"; s += "Free Space: " + d.FreeSpace/1024 + " Kbytes"; return(s); } [VBScript] Function ShowVolumeInfo(drvpath) Dim fso, d, s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath))) s = "Drive " & d.DriveLetter & ":- " &d.VolumeName
ShowVolumeInfo = s End Function
AvailableSpace 属性 | DriveLetter 属性 | DriveType 属性 | FileSystem 属性 | FreeSpace 属性 | IsReady 属性 | Path 属性 | RootFolder 属性 | SerialNumber 属性 | ShareName 属性 | TotalSize 属性
应用于:Drive 对象