标题: [网络连接] 批处理怎样ping查询指定范围的ip? [打印本页]
作者: lky216 时间: 2012-10-11 17:41 标题: 批处理怎样ping查询指定范围的ip?
想看看一些网址的ip,ping得通吗?ping不通保存下来。
但网址是a-z 0-9组合起来的。就是字典
请问怎么弄?
作者: poter 时间: 2012-10-11 23:59
回复 1# lky216
很麻烦的,只能是用if goto一层一层的嵌套,我只做了个三位数的测试,再多嵌套,我自己都要糊涂了- @ECHO OFF
- Setlocal enableDelayedExpansion
- set str=abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890
- :b1
- set /a count+=1
- call ping www.%%str:~!count2!,1%%%%str:~!count1!,1%%%%str:~!count!,1%%.com -n 1 >nul || call echo www.%%str:~!count2!,1%%%%str:~!count1!,1%%%%str:~!count!,1%%.com>>new.txt
- call set str1=%%str:~!count!,1%%
- call set str2=%%str:~!count1!,1%%
- if "!str1!"=="0" (
- set /a count1+=1
- set count=
- if "!str2!"=="0" (
- set /a count2+=1
- set count=
- set count1=
- goto b1
- ) else (goto b1)
- ) else (goto b1)
-
- :end
复制代码
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |