python - 检查进程是否仅使用 Python 内置模块在 Windows 中运行

标签 python windows process

我知道有几种方法可以使用 psutilwin32ui 模块完成该任务。但我想知道是否可以选择使用 Python 仅内置模块来做到这一点?我也发现了这个问题:

Check if PID exists on Windows with Python without requiring libraries

但在这种情况下,对象由 PID 定位,我想使用进程名称来完成。

最佳答案

也许这对你有帮助:

import subprocess

s = subprocess.check_output('tasklist', shell=True)
if "cmd.exe" in s:
    print s

关于python - 检查进程是否仅使用 Python 内置模块在 Windows 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25545937/

相关文章:

python - .pdbrc 文件中的断点命令

c# - 使用 Process.Start() 时将异常冒泡回调用者

delphi - Delphi如何获取其他进程的信息?

c - 如何立即从 Linux 中的 fork 子进程返回?

Python 和 CGI​​ : Prevent resending form data upon refreshing

python - 如何在 Python Flask 的 celery 任务中保留请求上下文?

python - 使用 API 从 Box 位置下载文件

c++ - Visual Studio 调试器在内联代码中速度变慢

windows - 如何在Windows上测试httpd.conf?

c++ - 我如何预测可能会发生严重的内存碎片问题?