我需要执行以下操作:
- 启动火狐
- 加载包含一些插件内容的页面
- 查找插件进程的processID
- 使用 processID 将 cdb 附加到插件进程
- 检测插件加载的 DLL
为了使用批处理脚本自动执行此操作,我需要一种方法来查找给定进程名称的 processID。有没有办法做到这一点?
我需要执行以下操作:
为了使用批处理脚本自动执行此操作,我需要一种方法来查找给定进程名称的 processID。有没有办法做到这一点?
You could use wmic to return that:
wmic process where name="cmd.exe" get processid
gets you pids of all cmd.exe running.
Assuming you do not know full process name (is that's why you could not use cdb -pn
?) you could also use like
:
wmic process where 'name like "%cmd%"' get processid
will get everything with cmd
anywhere in it's name. It's also possible to use other SQL wildcards.
To see what properties you can query, open wmic (just do wmic
from command line) and issue process get /?
Note: wmic produces output in Unicode and attaches double <CR>
to it's output lines. This sometimes requires special attention and handling in your batch.