试试这个
调用它并传递一个驱动器号,如“C”
注意:驱动器序列号由操作系统分配,因此如果重新格式化驱动器,序列号将不同。
- [font=Times New Roman][font=Times New Roman](defun VxGetDriveInfos (Drv / DrvObj FilSys RetVal) [/font]
- [font=Times New Roman](setq FilSys (vlax-create-object "Scripting.FileSystemObject") [/font]
- [font=Times New Roman] RetVal (cond [/font]
- [font=Times New Roman] ((= (vlax-invoke FilSys "DriveExists" Drv) 0) 0) [/font]
- [font=Times New Roman] ((setq DrvObj (vlax-invoke FilSys "GetDrive" Drv)) [/font]
- [font=Times New Roman] (cond [/font]
- [font=Times New Roman] ((= (vlax-get DrvObj "IsReady") 0) -1) [/font]
- [font=Times New Roman] ((list [/font]
- [font=Times New Roman] (/(vlax-get DrvObj "TotalSize") 1000.0) [/font]
- [font=Times New Roman] (/(vlax-get DrvObj "FreeSpace") 1000.0) [/font]
- [font=Times New Roman] (vlax-get DrvObj "DriveType") [/font]
- [font=Times New Roman] (vlax-get DrvObj "FileSystem") [/font]
- [font=Times New Roman] (vlax-get DrvObj "SerialNumber") [/font]
- [font=Times New Roman] (vlax-get DrvObj "ShareName") [/font]
- [font=Times New Roman] (vlax-get DrvObj "VolumeName") [/font]
- [font=Times New Roman] ) [/font]
- [font=Times New Roman] ) [/font]
- [font=Times New Roman] ) [/font]
- [font=Times New Roman] ) [/font]
- [font=Times New Roman] ) [/font]
- [font=Times New Roman]) [/font]
- [font=Times New Roman](if DrvObj (vlax-release-object DrvObj)) [/font]
- [font=Times New Roman](vlax-release-object FilSys) [/font]
- [font=Times New Roman]RetVal [/font]
- [font=Times New Roman]) [/font]
- [/font]
|