I need a utility built into several versions of Windows (XP to Win7 specifically) that can tell me if a particular port is in use. I've found a few different ways for each OS, but I'm looking for a single command that works across all of them.
Asked
Active
Viewed 343 times
2
-
by the way: i have seen this thread http://serverfault.com/questions/35218/in-windows-using-the-command-line-how-do-you-check-if-a-port-is-open, but it does not answer my queestion ;-) – dmeu May 25 '11 at 11:18
-
1There is not one tool, just a bunch of well-documented commands that have been around forever. What EXACTLY are you trying to do? – KCotreau May 25 '11 at 12:00
-
I want to see if a port is in use or not. and it must work on all windows system mentioned – dmeu May 25 '11 at 15:05
3 Answers
5
Perhaps Netstat? netstat -h will give options.

Bart Silverstrim
- 31,172
- 9
- 67
- 87
-
Ok, netstat is also an option thanks a lot! Somebody who knows about windows could confirm if it is present in all the windows systems? Thanks – dmeu May 26 '11 at 12:51
-
It's kind of a standard tool from the earlier days of UNIX, so I'd be surprised if it didn't go back to NT 3.x http://en.wikipedia.org/wiki/Netstat – Bart Silverstrim May 26 '11 at 12:53
-
`netstat -ab` will dump a list of binaries and their ports. I'm sure there are gui versions of netstat, but I've no experience with any. – OldTroll May 26 '11 at 13:18
-
@dmeu, `netstat` is available on every version of Windows since at least NT4/Win95. – John Gardeniers May 26 '11 at 13:22
-
3
If you use netstat -n
it will tell you the current in use ports. The -n
tells it not to try to resolve hostnames from IPs. You could also run it with -a
to have it TRY to resolve hostnames.

HostBits
- 11,796
- 1
- 25
- 39
-
also very correct! but i can only select one answer as correct one... :-( – dmeu May 26 '11 at 13:42
3
netstat -bona
This will link ports to processes. Very useful if you want to know what process is running on port X.
For easy reviewing I redirect the output to a file
netstat -bona > file.txt

Paul
- 337
- 3
- 11