回复 9楼 su0527
可能也是理解不同,ID与Serial Number应该是不同的。
看 Win32_DiskDrive Class 和 Win32_LogicalDisk Class 的描述:
? "** 物理磁盘驱动器 ******"
oService = GETOBJECT("winmgmts:")
oClasses = oService.InstancesOf("Win32_DiskDrive")
FOR EACH oClass IN oClasses
?
? "#" + TRANSFORM(NVL(oClass.index, "<NULL>")) + " 驱动器 - " + NVL(oClass.Description, "<NULL>") + 0h0D0A +;
"接口类型.." + NVL(oClass.InterfaceType, "<NULL>") + 0h0D0A +;
"型号......" + NVL(oClass.Model, "<NULL>") + 0h0D0A +;
"序列号...." + ALLTRIM(NVL(oClass.SerialNumber, "<NULL>")) + 0h0D0A +;
"固件号...." + NVL(oClass.FirmwareRevision, "<NULL>") + 0h0D0A +;
"容量......" + LTRIM(TRANSFORM(VAL(NVL(oClass.Size, "<NULL>")), "999,999,999,999,999")) + " Byte"
?
WAIT
?
ENDFOR
? "** 逻辑磁盘驱动器 ******"
oClasses = oService.InstancesOf("Win32_LogicalDisk")
FOR EACH oClass IN oClasses
? "盘符........" + NVL(oClass.DeviceID, "<NULL>") + 0h0D0A +;
"类型........" + NVL(oClass.Description, "<NULL>") + 0h0D0A +;
"文件系统...." + NVL(oClass.FileSystem, "<NULL>") + 0h0D0A +;
"空间大小...." + LTRIM(TRANSFORM(VAL(NVL(oClass.Size, "<NULL>")), "999,999,999,999,999")) + " Byte" + 0h0D0A +;
"可用空间...." + LTRIM(TRANSFORM(VAL(NVL(oClass.FreeSpace, "<NULL>")), "999,999,999,999,999")) + " Byte" + 0h0D0A +;
"卷标........" + NVL(oClass.VolumeName, "<NULL>") + 0h0D0A +;
"卷标序列号.." + NVL(oClass.VolumeSerialNumber, "<NULL>")
?
WAIT
?
ENDFOR