You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Cygwin64的pgrep工具无法正常获取svchost.exe进程PID问题求助

Cygwin64的pgrep工具无法正常获取svchost.exe进程PID问题求助

大家好,我遇到了一个棘手的问题:我安装了Cygwin64后,用管理员权限尝试使用它自带的pgrep.exe工具查找svchost.exe的PID,但多次执行命令都没有返回任何结果。不过从工具能正常输出帮助信息来看,它本身是能正常运行的,这就让我摸不着头脑了。

我执行的命令及对应的输出如下:

PS D:\cygwin64\bin> D:\cygwin64\bin\pgrep.exe svchost.exe

PS D:\cygwin64\bin> D:\cygwin64\bin\pgrep.exe svchost.exe -af

PS D:\cygwin64\bin> D:\cygwin64\bin\pgrep.exe -h
Usage:

pgrep [options] <pattern>

Options:

-d, --delimiter <string>  specify output delimiter

-l, --list-name           list PID and process name

-a, --list-full           list PID and full command line

-v, --inverse             negates the matching

-w, --lightweight         list all TID

-c, --count               count of matching processes

-f, --full                use full process name to match

-g, --pgroup <PGID,...>   match listed process group IDs

-G, --group <GID,...>     match real group IDs

-i, --ignore-case         match case insensitively

-n, --newest              select most recently started

-o, --oldest              select least recently started

-O, --older <seconds>     select where older than seconds

-P, --parent <PPID,...>   match only child processes of the given parent

-s, --session <SID,...>   match session IDs

-t, --terminal <tty,...>  match by controlling terminal

-u, --euid <ID,...>       match by effective IDs

-U, --uid <ID,...>        match by real IDs

-x, --exact               match exactly with the command name

-F, --pidfile <file>      read PIDs from file

-L, --logpidfile          fail if PID file is not locked

-r, --runstates <state>   match runstates [D,S,Z,...]

-A, --ignore-ancestors    exclude our ancestors from results

--cgroup <grp,...>        match by cgroup v2 names

--ns <PID>                match the processes that belong to the same
namespace as <pid>

--nslist <ns,...>         list which namespaces will be considered for
the --ns option.

Available namespaces: ipc, mnt, net, pid, user, uts

-h, --help     display this help and exit

-V, --version  output version information and exit

For more details see pgrep(1).

PS D:\cygwin64\bin>

可以看到,不管是直接执行pgrep.exe svchost.exe还是加上-af参数,都没有返回任何PID结果,但pgrep -h能正常输出完整的帮助文档,说明工具本身是正常运行的。有没有大佬能帮我分析下原因,或者给出解决办法呢?

备注:内容来源于stack exchange,提问作者D.J. Elkind

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.21 14:48:08