©
Ce document utiliseManuel du site Web PHP chinoisLibérer
JScript | 语言参考 |
返回连续十进制数字,用于唯一标识磁盘卷。
object.SerialNumber
object为Drive对象。
可以使SerialNumber属性来确保在带有可移动媒体的驱动器中插入正确的磁盘。
下列代码阐明了SerialNumber属性的用法:
function ShowDriveInfo(drvpath){ var fso, d, s, t; fso = new ActiveXObject("Scripting.FileSystemObject"); d = fso.GetDrive(fso.GetDriveName(fso.GetAbsolutePathName(drvpath))); switch (d.DriveType) { case 0: t = "Unknown"; break; case 1: t = "Removable"; break; case 2: t = "Fixed"; break; case 3: t = "Network"; break; case 4: t = "CD-ROM"; break; case 5: t = "RAM Disk"; break; } s = "Drive " + d.DriveLetter + ": - " + t; s += "
" + "SN: " + d.SerialNumber; return(s); }
版本 1