@echo off
setlocal enabledelayedexpansion
for /f %%i in (2,1,99) do (
set ip=192.168.1.%%i
for %%j in (8080 3299) do (
start telnet.exe !ip! %%j
ping -n 4 127.1>nul
set a=
for /f "skip= tokens=2" %%k in ('tasklist /fi "windowtitle eq telnet !ip!"') do set /a a=%%k
if !a! gtr 1 (echo !ip! %%j>>ok.txt) else echo !ip! %%j >>err.ok
)
)