我不熟悉Windows注册表,目前正在尝试使用Python从Windows注册表中获取一个配置文件名的列表,但我不确定我做错了什么。我的代码如下:
from winreg import *
def get_profiles():
regKey = OpenKey(HKEY_LOCAL_MACHINE,
r'SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList')
recent = QueryValueEx(regKey,'DisplayName')[0]
recent_list = []
for subkey in recent:
recent_list.append(QueryValueEx(regKey,subkey)[0])
return recent_list
当我试着在上面跑的时候:
^{pr2}$我预感到'DisplayName'
部分是错误的,我应该如何更正它?在
您可以使用
EnumKey
获取打开的注册表项的子项。在同时,根据文件说明。在
},因此支持with语句的上下文协议:
^{2}$HKEY
对象实现了__enter__()
和{当控件离开with块时将自动关闭键。在
相关问题 更多 >
编程相关推荐