aardio 文档

aardio 范例: 取硬盘序列号

//取硬盘序列号
import console;

//方法一:得到所有硬盘序号,分区等
import sys.storage;
var devices = sys.storage.getDevices()
for(idx,drives in devices){
    var property = sys.storage.queryProperty( idx );
    if(!property) continue ;
    console.log( property.productId )
    console.log( property.serialNumber )
    for(j=1;#drives;1){
        console.log( drives[j] ) 
    }  
}

//方法二:取所有分区信息、分区序列号
import sys.volume;
var drives = sys.volume.getLogicalDrives()
for(i,drv in drives){
    var info = sys.volume.getInfo( drv)  ;
    if(info)
          console.log( 
            "分区:"+info.drive,
            "序列号"+ info.serial,
            info.serialNum,"文件系统:" + info.fsys, 
            "压缩:" + ((info.flag & 0x8000/*_FILE_VOLUME_IS_COMPRESSED*/) ? "是" : "否") 
            );  

}

import sys.hd; //需要管理权限
console.log( "物理序列号", ..sys.hd.getInfo()[["sSerialNumber"]] );

console.pause();

Markdown 格式