How do I kill the process currently using a port on localhost in Windows?
Step 1: Open up cmd.exe (note: you may need to run it as an administrator, but this isn’t always necessary as long as you are trying to kill a port which is started within your user), then run the below command:
netstat -ano | findstr :<PORTNO>
Example: netstat -ano | findstr :8080
(Replace <PORT> with the port number you want, but keep the colon)
Step 2: Next, run the following command:
taskkill /PID <PID> /F
Example: taskkill /PID 4664 /F
SUCCESS: The process with PID 4664 has been terminated.
References : https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/windows-commands