How to check the port status of multiple IP Addresses from windows command prompt. I am looking for some Batch file or a Dos SCRIPT. Can anyone help on this?
Asked
Active
Viewed 1.1k times
1
-
1You could probably do this with `PortQry`. Do you always need to check the same ports? UDP/TCP/Both? – Bart De Vos Sep 08 '11 at 11:29
-
2PortQry is useful but how to make a batch script or portqry to read the host list from a txt file, exicute the command and send the result to -l log.txt file – Sunil Reddy Sep 08 '11 at 14:21
-
Thnx all for the support, My requirement got solved by using PortQry. – Sunil Reddy Sep 08 '11 at 16:01
-
i used the below in to the batch file. – Sunil Reddy Sep 08 '11 at 16:02
-
1set protocol=TCP set port#=8080,4343,18443 for /f "tokens=1" %%V in (hs.txt) do portqry -n %%V -p %protocol% -o %port#% – Sunil Reddy Sep 08 '11 at 16:02
2 Answers
3
You could use nmap http://nmap.org to script something to check and list whats open on a given host or set of hosts
TiZon is right though, wed need to know more about what youre wanting to do before we could give a more concise answer.... Are you checking more than one host, the same ones over and over, more than one port, etc?
Just a wild assumption... If you want a robust monitoring and alerting system you could look at nagios www.nagios.org its free and does a great job monitoring and alerting for things like open / closed ports

Mike Brentlinger
- 41
- 1
-
Yes i am trying to find the status of multiple ports like 8080,4343 on multiple IP addresses i.e list of systems in a txt file. – Sunil Reddy Sep 08 '11 at 13:18
0
I second nmap, but you can check for open connections with telnet
Telnet computer port
Such as:
telnet webserver1 80

gWaldo
- 11,957
- 8
- 42
- 69
-
i have to find the multiple port status for multiple IP address nearly about 400+ systems. I am looking for any simple batch script which can generate the status of port in to a log file. – Sunil Reddy Sep 08 '11 at 13:31
-
This can be accomplished via a `for` loop given a list of servers, and at the end of the telnet command, append ">> filename.log" to the end of the command so that it appends the output to a file of your choosing (creating the logfile if it doesn't exist.) – gWaldo Sep 08 '11 at 15:11