明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 7050|回复: 12

用LISP怎么样获取硬盘的物理序列号?或是网卡的MAC地址?

  [复制链接]
发表于 2004-3-7 22:09:00 | 显示全部楼层 |阅读模式
用LISP怎么样获取硬盘的物理序列号?或是网卡的MAC地址?
发表于 前天 10:15 | 显示全部楼层

;获取网卡号

;;Test OK with XP
;;Use WMI to Get Networkadapter MAC.
;;Author : eachy [eachy@xdcad.net]
;;Web : http://www.xdcad.net
;;2005.11.22
(defun xdl-MACAddress (/ mac WMIobj serv lox sn)
  (vl-load-com)
  (setq mac '())
  (if (SETQ WMIobj (VLAX-CREATE-OBJECT "wbemScripting.SwbemLocator"))
    (progn (SETQ serv (VLAX-INVOKE WMIobj 'ConnectServer "." "\\root\\cimv2" "" "" "" "" 128 nil))
           (setq lox (vlax-invoke serv 'ExecQuery "Select * From Win32_NetworkAdapter "))
           (vlax-for item lox
             (if (and (= (vlax-get item 'NetConnectionID) "本地连接") ;中文系统
                      (not (member (setq sn (vlax-get item 'MACAddress)) mac))
                 )
               (setq mac (cons sn mac))
             )
           )
           (mapcar 'vlax-release-object (list lox serv WMIobj))
    )
  )
  (reverse mac)
)
回复 支持 反对

使用道具 举报

发表于 2021-7-24 00:08:06 | 显示全部楼层

每个人的系统不一样,不一定是你说的这个macaddress单词
发表于 2004-3-7 23:25:00 | 显示全部楼层
;;by mmmm 提供 利用OS命令獲取ipaddress & macaddress 在LISP中直接調用
(command "_.Shell" "ipconfig /all >c:\\result.txt") 讀取文件c:\result.txt,從中找到ipaddress & macaddress
 楼主| 发表于 2004-3-8 11:53:00 | 显示全部楼层
十分感谢。
发表于 2004-3-8 15:44:00 | 显示全部楼层
利用DOSLIB6.1好象也可以,不用打开文本文件来寻找.
发表于 2004-3-8 16:33:00 | 显示全部楼层
发表于 2004-3-8 18:45:00 | 显示全部楼层
當然也可以配合doslib

dos_ipaddress


Returns a list of local IP addresses.

Syntax

(dos_ipaddress)

Parameters

n/a

Returns

A list of strings containing the local ip addresses and subnet mask if successful.

nil on error.

Example

Command: (dos_ipaddress)

("204.177.179.67" "255.255.255.0")

dos_macaddress


Returns the system's media access control (MAC) addresses.

Syntax

(dos_macaddress)

Parameters

n/a

Returns

A strings containing the local MAC address if successful.

nil on error.

Example

Command: (dos_macaddress)

"00:00:86:4A:CF:7F"

发表于 2005-11-14 23:05:00 | 显示全部楼层
我怎么没有找到这个文件?
发表于 2005-11-15 09:52:00 | 显示全部楼层
发表于 2005-11-15 09:54:00 | 显示全部楼层
发表于 2005-11-15 20:26:00 | 显示全部楼层
多谢!和doslib6.1一样吗?用法呢?exe文件也一样可以加载吗?这个文件是你自己编写的吗?
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2025-5-16 16:33 , Processed in 0.183541 second(s), 27 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表