Regularly, at work, I will be given a big list of IPs and different ports to check. In cases where I just need to show they're reachable, I will make a batch file with multiple lines like
ping 192.168.1.1
ping 192.168.1.2
...but often, they need different ports. I usually just telnet into them and, if it goes to a black screen, I know it's up. what I would like to do is something like I do above, but with telnet so it runs the command, closes the window when it opens and runs another. Any ideas?
Try PUTTY (google for it), a free open source package, that is scriptable and line command driven. It is also an alternative to Hyperterminal no longer delivered by Microsoft. I never used it, but people report it is very effective.
netsh diag connect iphost IP_address port The diag context was removed in Windows 7.
You could also use nmap or expect (scriptable telnet).
Tony
If you're doing this from Win7 and you're not allowed to install anything, PowerShell is an option. "192.168.1.1:80", "192.168.1.2:23" | ForEach-Object { $ErrorActionPreference = "SilentlyContinue" Clear-Variable socket $server = $_ -Split ":" $socket = New-Object System.Net.Sockets.TcpClient($server[0], $server[1]) ` -ErrorVariable socketError if ($socket -ne $null) {$_ + " is UP"; $socket.Close()} else {$_ + " is DOWN"} }
I ended up able to do it with nmap. Heck of a program. Thanks
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |