You're stuck in a network without internet access, you don't have a port scanner with you, can't leave to get one, no other options..... what do you do? WHAT DO YOU DO????
Thus was born the Ghetto as All Get Out Port Scanner. What an ugly bit of code.
This was being built into a larger script so there's some stuff missing here obviously. The File ~temp2 would have the list of ip addresses. You would need to change the port (9100 in this case) or assign a new variable to handle running through the ports you wanted to check.
Of course you need telnet installed so this isn't windows vista / 7 compatible.
for /f %%i in (~temp2) do (
start /min telnet %%i 9100
ping -n 5 127.0.0.1 > nul
netstat -n | find /i "%%i:9100" | find /i "Established" && echo %%i >> up.txt
taskkill /f /IM telnet.exe