Thanks so much for your response. I think what you have provided code wise is what I am looking for (with minor tweak). Basically, I am using an automation tool to install an agent based app across 100s of servers . One of the pre-req this agent based app has is to make sure port # 2222 is not being utilized by anything other process or service.
So, my bat script should do a "check" for that port# and should tell me that given port is available.
I hope I am king sense here.
Thanks again for your help.