I'm on a Windows machine. Typically, when I need to kill a process on a port I do the following:
netstat -ano | findstr : <PORT>
After that command, the Process Identifier (PID) should appear and using that PID, I would do:
taskkill /PID <PID> /F
Then there's a response that the process has been terminated.
My issue now is that I'd like to kill the process on port 27017. So that I can use that port for a connection to Mongo. When I run: taskkill /PID 27017 /F
I get the response FINDSTR: Cannot open 27017
. Is there a way around this so that I can kill the task on that port. I've tried to restart as well, but that's not really doing me any good.
Any help would be appreciate and thanks in advance!
Copyright Notice:Content Author:「ENV」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/67115945/how-to-kill-process-on-port-on-windows-when-the-port-cannot-be-opened