繁体   English   中英

使用Python,我如何获得该进程的运行进程和exe名称?

[英]Using Python, how can I obtain the running process and the exe name for that process?

假设我有一个exe运行,它的名字是myexe.exe 在Windows上,我可以在Process Explorer中看到myexe.exe的进程。 使用Python,我如何获取myexe.exe的进程ID并将其关闭?

如果您使用wmi (Windows Management Instrumentation模块),则可以通过wmi服务执行此操作。 在这里查看获取进程名称并使用进程ID终止的示例

在Windows上执行此操作的最佳方法是使用PyWin32( http://sourceforge.net/projects/pywin32

请查看以下代码示例: http//coding.derkeiler.com/Archive/Python/comp.lang.python/2007-10/msg00717.html

它可能正是您所需要的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM