python读取windows安装的所有应用
作者:
Aedda | 来源:发表于
2020-10-20 17:54 被阅读0次import winreg
#需要遍历的两个注册表
sub_key = [r'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall', r'SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall']
for i in sub_key:
key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, i)
for j in range(winreg.QueryInfoKey(key)[0]):
try:
each_key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, f'{i}\\{winreg.EnumKey(key, j)}')
DisplayName = winreg.QueryValueEx(each_key, 'DisplayName')[0]
print(DisplayName.encode('utf-8'))
except WindowsError:
pass
本文标题:python读取windows安装的所有应用
本文链接:https://www.haomeiwen.com/subject/ldndmktx.html
网友评论