gpt4 book ai didi

node.js - 如何停止在 Windows 上运行带有标题的 npm 进程?

转载 作者:可可西里 更新时间:2023-11-01 10:41:29 25 4
gpt4 key购买 nike

在 Linux 和 OSX 中,我曾经在 app.js 上设置我的进程标题为:

process.title = "xmlImporter";

package.json 上将定义:

"stop": "pkill --signal SIGINT xmlImporter"

只需运行 npm stop 我就可以停止具有给定标题的进程。

如何在 Windows 系统上实现?

最佳答案

下面的命令应该可以解决问题

taskkill /FI "windowtitle eq xmlImporter"

/FI 将允许您进行过滤,如果这不起作用,请尝试为 xmlImporter* 进行过滤,星号是通配符。请记住,您需要以提升的权限运行,如果进程仍无法停止,请尝试添加/F 以强制执行操作。

顺便说一句,您可以使用以下过滤器:

Filter Name   Valid Operators           Valid Value(s)
----------- --------------- -------------------------
STATUS eq, ne RUNNING |
NOT RESPONDING | UNKNOWN
IMAGENAME eq, ne Image name
PID eq, ne, gt, lt, ge, le PID value
SESSION eq, ne, gt, lt, ge, le Session number.
CPUTIME eq, ne, gt, lt, ge, le CPU time in the format
of hh:mm:ss.
hh - hours,
mm - minutes, ss - seconds
MEMUSAGE eq, ne, gt, lt, ge, le Memory usage in KB
USERNAME eq, ne User name in [domain\]user
format
MODULES eq, ne DLL name
SERVICES eq, ne Service name
WINDOWTITLE eq, ne Window title

可以通过运行 taskkill/? 找到此信息

关于node.js - 如何停止在 Windows 上运行带有标题的 npm 进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53688301/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com