Computing.Net > Forums > Windows Server 2003 > Netstat in Windows Batch script

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Netstat in Windows Batch script

Reply to Message Icon

Name: wweeee (by wcube)
Date: August 8, 2007 at 21:10:56 Pacific
OS: Win 2003
CPU/Ram: N/A
Product: N/A
Comment:

Hi all, how can I possibly check windows server port availability in a batch file? I would like to check whether if the port is available, and if it is, try to start another batch file.

The command that I am using is netstat -a | find "<port number>". Does anyone know how can I place this line in an IF statement, in order to get the boolean or the status from netstat and check the if the condition fulfills.

Any help from your expertise is greatly appreciated ... Many thanks!



Sponsored Link
Ads by Google

Response Number 1
Name: Mechanix2Go
Date: August 10, 2007 at 07:33:20 Pacific
Reply:

netstat -a | find "77777777"
if not errorlevel 1 call myother.bat


=====================================
If at first you don't succeed, you're about average.

M2



0
Reply to Message Icon

Related Posts

See More


HP Scanjet 5100c driver Security Log Errors on SB...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Windows Server 2003 Forum Home


Sponsored links

Ads by Google


Results for: Netstat in Windows Batch script

Sqlplus batch script under win2003 www.computing.net/answers/windows-2003/sqlplus-batch-script-under-win2003/4122.html

Trap in a batch file www.computing.net/answers/windows-2003/trap-in-a-batch-file/9540.html

ActiveX control in Windows 2003 www.computing.net/answers/windows-2003/activex-control-in-windows-2003/5280.html