@echo off
echo IP Ping 工具
:x
::set /p choice="请输入扫描类型:A or B :"
set choice=A
if /i %choice%==a goto ipduan else goto y
:y
if /i %choice%==b goto ip else goto x
@------scan ip------@
:ipduan
set /p ipAddress="输入IP网段(192.168.0):"
set /p startIP="输入起始IP:"
set /p endIP="输入结束IP:"
echo scan from %ipAddress%.% startIP% to %ipAddress%.%endIP%
for /l %%i in (%startIP%,1,%endIP%) do (call :ping %ipAddress%.%%i)
::-------检测结果------------::
for /f "delims=" %%a in ('dir /b "*.ip"') do (echo ------------>%%~na 可以Ping通!)
pause>nul
@--------this is telnet method-------@
:telnet (ip,port)
set /p ipa="输入扫描的ip:(例如:192.168.0.1)"
set /p port1="输入要扫描的开始端口:"
set /p port2="输入要扫描的结束端口:"
for /l %%i in (%port1%,1,%port2%) do (telnet %ipa% %%i)
@---------this is ping method-------@
:ping (ip)
echo scaning %~1 ....
start /b cmd /q /c "for /f "tokens=1-3 delims=(%%)" %%a in ('ping %~1 -n 1^|findstr "字节="') do (if not "%%a"=="" (echo %%a>"%~1.ip"))"