Solved Batch to telnet to different IPs

April 4, 2012 at 14:56:03
Specs: Windows 7
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

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?

See More: Batch to telnet to different IPs

Report •

April 5, 2012 at 06:45:50
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.

Report •

April 7, 2012 at 17:33:20
✔ Best Answer
netsh diag connect iphost IP_address port

The diag context was removed in Windows 7.

You could also use nmap or expect (scriptable telnet).

Report •

April 9, 2012 at 10:03:34
If you're doing this from Win7 and you're not allowed to install anything, PowerShell is an option.
"", "" | 
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"}

How To Ask Questions The Smart Way

Report •

Related Solutions

April 9, 2012 at 10:07:41
I ended up able to do it with nmap. Heck of a program. Thanks

Report •

Ask Question