Wednesday, April 25, 2012

How to check whether the port 80 is available using a batch file in windows xp

I'm writing a batch file to automatically checks the port 80 availability and give an error message if it is using by another program. But I'm not sure how to check the port 80 availability in a batch file.



I found following command to check that with terminal.



 netstat -o -n -a | findstr 0.0:80


But I need to check it with a batch file like follows



if (!//port 80 is available) {
// Give an error message
} else {
// Continue with the rest
}


Can someone please help me on this.





No comments:

Post a Comment