是否有一种更新的方法可以使用python从Windows注册表访问和列出已安装程序



我需要能够从已安装的程序(安装日期、名称、路径等(中获取某些信息,并且我尝试使用 winreg 库但它不起作用,我试图将其放入 JSON 对象,每当我运行脚本时,它都会运行但不输出我需要的信息。

import winreg
import wmi
r = wmi.Registry ()
result, names = r.EnumKey (
    hDefKey=_winreg.HKEY_LOCAL_MACHINE,
    sSubKeyName="Software"
)
for key in names:
    print(key)

在 Python 3.7 中:

import winreg
import wmi

在旧版本中:http://timgolden.me.uk/python/wmi/cookbook.html

最新更新