如何删除已分配给端口的当前进程/应用程序?
How can I remove the current process/application which is already assigned to a port?
例如:localhost:8080
推荐答案步骤1:
打开cmd.exe(注意:您可能需要以管理员身份运行它,但这并不总是必需的),然后运行以下命令:
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
(用所需的端口号替换PORT_NUMBER,但保留冒号)
(Replace PORT_NUMBER with the port number you want, but keep the colon)
以红色圈出的区域显示PID(过程标识符).找到正在使用所需端口的进程的PID.
The area circled in red shows the PID (process identifier). Locate the PID of the process that's using the port you want.
第2步:
下一步,运行以下命令:
Next, run the following command:
taskkill /PID PORT_NUMBER /F
(这次没有冒号)
最后,您可以通过重新运行步骤1"中的命令来检查操作是否成功.如果操作成功,您将不会再看到该端口号的搜索结果.
Lastly, you can check whether the operation succeeded or not by re-running the command in "Step 1". If it was successful you shouldn't see any more search results for that port number.
更多推荐
如何在Windows中使用localhost上的端口杀死当前进程?
发布评论