Python读取服务描述

2024-04-25 22:51:48 发布

您现在位置:Python中文网/ 问答频道 /正文

我想让我的python脚本读取windows服务描述,以便决定是否停止它\使其仅手动运行。。 关键是我没有找到读取描述的方法。 (可能类似于“GetServiceDescription”)。你知道吗

有人帮忙吗?你知道吗


Tags: 方法脚本windows手动关键
1条回答
网友
1楼 · 发布于 2024-04-25 22:51:48

您可以使用wmi库,也可以遵循其他答案,如List running processes on 64-bit Windows。你知道吗

我还没有测试过这个,但这应该是列出它们的简短片段reference

import wmi
c = wmi.WMI()
for service in c.Win32_Service(): #if its win32
    print service.Name

按照这个tutorial

If you find it tough to follow may be looking at the tutorial may help or come again with another question.

相关问题 更多 >