Skip to content

Instantly share code, notes, and snippets.

@pcostarg
Last active January 4, 2023 16:02
Show Gist options
  • Save pcostarg/42688125707ac2e49571a7de38635bfd to your computer and use it in GitHub Desktop.
Save pcostarg/42688125707ac2e49571a7de38635bfd to your computer and use it in GitHub Desktop.
Task Kill a PID blocking a port on Windows

Task Kill a PID blocking a port on Windows

Using npm scripts in parallelshell I got into a situation that a crash on it made node not quit gracefully and could not restart script as node was still listening to port 9090 (live-reload). this scripts find the process and kill it

Note: find command only works on command line

Get PID:

netstat -ano | find "9090"

Kill process with PID:

taskkill -F -PID 123456

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