原来那个外网IP获取是通过swz8.com网站提取的
现在这网站已经关了 小弟从ip138找到了它的IP获取页面
但文字处理上 俺不大会 请帮忙完善
@echo off
title 获取本机内网和外网IP
if exist ip2city.asp del ip2city.asp
if exist ip.txt del ip.txt
if exist 1.txt del 1.txt
if exist 2.txt del 2.txt
wget http://www.ip138.com/ip2city.asp
ren ip2city.asp 1.txt
此时1.txt内容为
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title> 您的IP地址 </title>
</head>
<body style="margin:0px"><center>您的IP地址是: 来自:湖南省株洲市 电信</center></body></html>
以下再用SED提取
sed -r "s/(+\.+\.+\.+).*/\n\1/;s/^.*\n//" 1.txt >2.txt
for /f %%i in (2.txt) do set i=%%i
echo %i% >ip.txt
start ip.txt
IP.txt内容为
1.1.1.1空格接回车
我是新手 请高手帮忙精简完善 去掉IP.TXT的空格接回车