dalianliyan
6/6/2018 - 3:41 AM

Microsoft Scripting Runtime

//
//在项目菜单中选择引用,在COM中选择Microsoft Scripting Runtime
using Windows.Scripting;
public string GetDriverSerialNumber(string strDriver)
{
    string functionReturnValue = null;
    try 
    {
        FileSystemObject Fso = new FileSystemObject();
        Drive drvDisk = default(Drive);
        drvDisk = Fso.GetDrive(strDriver);
        functionReturnValue = drvDisk.SerialNumber;
    } 
    catch (Exception ex) 
    {
        functionReturnValue = "00000000000";
    }
    return functionReturnValue;

}

Scrrun.dll

  • FileSystemObject