Languages
[Edit]
EN

Windows - kill process that listen on specific port using cmd.exe

9 points
Created by:
Violetd
865

Quick solution:

netstat -ano | findstr LISTENING | findstr :your_port_number
taskkill /PID your_PID_number /F

 

1. Introduction

This article is focused to solve problem, how to kill process (PID) that listens on specific port under Windows CMD (Windows Command). Simple solution how to do it with taskkill command is described below.

2. taskkill program example

Do following steps:

Step 1. Run cmd.exe as Administrator

Step 2. Execute netstat command:

C:\>netstat -ano | findstr LISTENING | findstr :80
netstat listing processes that uses port 80 - Windows CMD
netstat listing processes that uses port 80 - Windows CMD

 Step 3. Execute taskkill command:

C:\>taskkill /PID 548 /F
taskkill apache2 killing process example - Windows CMD
taskkill apache2 killing process example - Windows CMD

Where:

  • for netstat -ano | findstr LISTENING | findstr :80 double fitering is used: by LISTENING and later by :80; more detailed description can be found here,
  • for taskkill:
    • /PID 548 represents killed process id,
    • /F stopd process event it does not responds.

Note: read more about netstat -ano here.

Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join