In either XP or 2k Pro I want to be able to open the command prompt , list active/open ports and shutdown ports at my choosing. I use netstat -ao to list ports and PID's currently and I can stop the services but I want to be able to close ports at the command prompt.
Ugh. I don't know about the command prompt, but you can do it in Network Properties in Advanced options. I'll make a more formal walk-through when I get home. I'm on Win2K here at work.
Generally ports can't be opened and closed in user mode. Applications use operating system calls which bind the application to a specific socket in the TCP/IP stack, which remains bound until either the application closes the port or the application is terminated.
If you are concerned about security issues of having open ports, there are two solutions:
1. Terminate the application using the port/disable the service
2. Use a firewall to block external access to these ports. They will still show as open in netstat, but inaccessible to the outside world.
There's a free utility called Fport by Foundstone Labs which functions like netstat but will map ports to running processes and tell you which applications are bound to open ports.