我有这个代码
from winreg import *
aReg=ConnectRegistry(None, HKEY_CURRENT_USER)
aKey=OpenKey(aReg, 'Software\Microsoft\Windows\CurrentVersion\Explorer\Accent')
aKey=EnumValue(aKey, 0)
print(aKey[1])
当我运行它时,它返回这个b'\xb3\xec\xff\x00\x80\xe0\xff\x00Y\xd6\xff\x00)\xa4\xcc\x00\x00s\x99\x00\x00Ws\x00\x00:M\x00\x88\x17\x98\x00'
但在注册表编辑器中,它看起来像这样:
我想问一下,如何解码第一个到第二个。
感谢您的任何回复。 :)
最佳答案
如果您想要一个特定值(而不是一次枚举每个值),您可以使用 QueryValueEx()
函数,如下所示:
from winreg import *
hreg = ConnectRegistry(None, HKEY_CURRENT_USER)
hkey = OpenKey(hreg, 'Software\Microsoft\Windows\CurrentVersion\Explorer\Accent')
accent_color_menu = QueryValueEx(hkey, 'AccentColorMenu')[0]
CloseKey(hkey)
print(accent_color_menu)
这会给你类似的东西:
4292311040
关于python - 如何使用 winreg 解码注册表值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44029405/