Languages
[Edit]
EN

Windows - how to kill process that listen on specific port with cmd?

6 points
Created by:
Marcin
2477

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.

Hey ūüĎč
Would you like to know what we do?
  • Dirask is a friendly IT community for learners, professionals and hobbyists to share their knowledge and help each other in extraordinary easy way.
  • We welcome everyone,
    no matter what the experience,
    no matter how basic the question is,
    this community will help you.