返回一个 Drives 集合,包含了本地机器上所有可用的 Drive 对象。 object.Drives object 应为 FileSystemObject 。 说明 可移动媒体的驱动器不需要插入媒体就可以出现在 Drives 集合中。 可以通过 Enumerator 对象和 for 语句来逐个引用 Drives 集合中的成员: function ShowDriveList() { var fso, s, n, e, x; fso = new ActiveXObject("Scripting.FileSystemObject"); e = new Enumerator(fso.Drives); s = ""; for (; !e.atEnd(); e.moveNext()) { x = e.item(); s = s + x.DriveLetter; s += " - "; if (x.DriveType == 3) n = x.ShareName; else if (x.IsReady) n = x.VolumeName; else n = "[驱动器未就绪]"; s += n + "<br>"; } return(s); }
Drives 属性 |