Friday, 28 January 2011

Getting port number of a running application

There are a couple of applications that may fail to start and complaint because its port is being used by a different application. This is a quick and dirty way of knowing which application is responsible for tying up a port on a Windows box.






Open up a command prompt:



1.Start
Run
type cmd
Enter

2.Type netstat -aon
findstr “[port number]“

3.Take note of the numbers on the last line. This is the PID or Process ID.

4.Type tasklist
findstr “[PID]“ and this will return the application corresponding to that PID.

5.Once PID is determined, you can now kill it in Task Manager or kill it typing tskill at the command prompt.





For example:



1.I type netstat -aon
findstr “8080″ at command prompt (I’m on a proxy by the way)

2.I see that the PID is 3624

3.I type tasklist
findstr “3624″ to find what PID 3624 is and it points to msnmsgr.exe which is MSN/Live Messenger.

4.I can now kill MSN Messenger from Task Manager or type tskill 3624