SerialNumber 属性

返回连续十进制数字,用于唯一标识磁盘卷。

object.SerialNumber

objectDrive 对象。

说明

可以使 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 += "<br>" + "SN: " + d.SerialNumber;
  return(s);
}

要求

版本 1

NetPc