Windows command line to find processes using a certain port

Sometimes due to various needs, you want to find the process that occupies a certain port on your computer. You need to use the graphical interface to have a special tool. Under the command line, as long as the netstat command and the tasklist command are combined, it is very convenient to find.

First, use the netstat -anob|find "local IP:port" command to list the process IDs that use this port, such as viewing the process IDs that use port 49620 on this machine:

There are also good tools under the windows command line (2)--find processes that use a certain port

Or use netstat -anob|findstr 127.0.0.1:49620 to also list the process number: then use tasklist |findstr 5544

There are also good tools under the windows command line (2)--find processes that use a certain port

There are also good tools under the windows command line (2)--find processes that use a certain port

或tasklist|find "5544"

There are also good tools under the windows command line (2)--find processes that use a certain port

You can find esayMule.exe that uses port 5544

If you don't need this process, you can kill the process with taskkill /pid 5544.

The format and options of the netstat command are as follows:

There are also good tools under the windows command line (2)--find processes that use a certain port

You can understand the role of the anob option.

Some people ask if netstat -anob directly lists the program name corresponding to the port, why use tasklist to find it, that's right. When adding the b parameter, the process name is listed, but it is more troublesome to find if there are too many. In addition, sometimes each line in the command window is too long, and it will wrap. program name.

Note that sometimes multiple programs with the same name may be running at the same time. If you directly use the process name to terminate the program, they may be terminated, not just the process occupying this port. Using the process number will avoid this situation.

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326617079&siteId=291194637