
[分享]批處理查詢IP地址歸屬地
- call:IP_inquiry 112.234.1.110
- echo %ret_str%
- pause
- exit/b
- ::======================= 查詢IP地址 ==============================
- :IP_inquiry <IP> 返回值=ret_str
- set cmdstr=curl -s http://www.ip138.com/ips8.asp?ip^=%~1^&action=2^|sed -n /本站主數(shù)據(jù)/ s/.*^>本站主數(shù)據(jù):([^^^<]*).*/1/p
- for /f tokens=* delims= %%a in ('%cmdstr%') do set ret_str=%%a
- goto:eof
nclick="copycode($('code0'));">復(fù)制代碼
服務(wù)器可自行更改(要改代碼), 不過這個服務(wù)器速度還不錯.主要是分享服務(wù)器IP ^.^這個網(wǎng)站也可查自己外網(wǎng)IP, 如下:
- call:IP_WAN
- echo %ret_str%
- pause
- exit/b
- ::======================= 查詢外網(wǎng)IP地址 ==============================
- :IP_WAN 返回值=ret_str
- set cmdstr=curl -s http://www.ip138.com/ips8.asp^|sed -n /您的IP地址是/{s/^<[^^^>]*^>//g;p}
- for /f tokens=* %%a in ('%cmdstr%') do set ret_str=%%~a
- goto:eof
nclick="copycode($('code1'));">復(fù)制代碼