Skip to content

Instantly share code, notes, and snippets.

@devded
Created July 24, 2021 22:01
Show Gist options
  • Save devded/c47e31d08b77344112188d8f9c71a2d0 to your computer and use it in GitHub Desktop.
Save devded/c47e31d08b77344112188d8f9c71a2d0 to your computer and use it in GitHub Desktop.

Step 1:

Open up cmd.exe (note: you may need to run it as an administrator, but this isn't always necessary), then run the below command:

netstat -ano | findstr <Port Number>

(Replace with the port number you want, but keep the colon)

The area circled in red shows the PID (process identifier). Locate the PID of the process that's using the port you want.

Step 2:

Next, run the following command:

taskkill /F /PID <Process Id>

Example

STEP - 1
netstat -ano | findstr 8080
TCP  0.0.0.0:18080    0.0.0.0:0     LISTENING    19788
TCP  [::]:18080       [::]:0        LISTENING    19788
STEP - 2
taskkill /F /PID 19788
SUCCESS: The process with PID 19788 has been terminated.

Source

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment