明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1481|回复: 3

提取ip的方法

[复制链接]
发表于 2006-2-21 10:14 | 显示全部楼层 |阅读模式
除了用shell的方法还有什么可以提取ip的方法?(command "_.Shell" (strcat "ipconfig >" "c:\\lhy_leo\\ip.txt"))
"觉得好,就打赏"
还没有人打赏,支持一下
发表于 2006-2-21 13:05 | 显示全部楼层

http://discussion.autodesk.com/thread.jspa?messageID=1195544

;;############### Begin GetIP.lsp ###############
(defun getIP ( / Reg-Key ipAddy)

(setq Reg-Key (strcat
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\"
(car (vl-registry-descendents
"HKEY_LOCAL_MACHINE\\SYSTEM\\ControlSet001\\Services\\"))
"\\Parameters\\Tcpip") )

(setq ipAddy (vl-registry-read Reg-Key "DhcpIPAddress"))

ipAddy
)

;;############### End GetIP.lsp ###############

发表于 2006-2-21 16:04 | 显示全部楼层
alin版大厉害,不过这句(setq ipAddy (vl-registry-read Reg-Key "DhcpIPAddress"))返回值不是本机的IP地址,改成(setq ipAddy (cadr (vl-registry-read Reg-Key "IPAddress")))返回本机的IP
 楼主| 发表于 2006-2-21 16:41 | 显示全部楼层
每台机器可能会不一样,看一下上面的连接吧。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-5-6 16:00 , Processed in 0.244775 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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