如何使Python的winreg看到注册表中的条目,这些条目在Adobe CC程序的注册表编辑器中可见?

2024-05-10 01:21:04 发布

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

我试图使用python的winreg库访问Adobe产品(Photoshop、After Effects等)的注册表项,虽然我可以在注册表编辑器中看到HKEY_LOCAL_MACHINE子项,但python似乎看不到相同的键。是否有需要更改的权限,或者我是否以错误的方式处理此问题

Here is a Screen cap summarizing the results so far

我运行的代码是:

import winreg
i=0
while True:
    try:
        # self.aeKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\After Effects\\16.0")
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Adobe\Setup\Reader")

        printTest = winreg.EnumKey(key, i)
        print(printTest)
        i+=1
    except WindowsError:
        break

结果我得到了

Acrobat Distiller
Acrobat PDFMaker
Adobe AIR
Adobe ARM
CommonFiles
ExtendScript Toolkit
ExtensionManager
PDF Admin Settings
Registration
Repair
Setup

但不是

Adobe BridgeAdobe AcrobatAfter EffectsPhotoshop等等

编辑:我目前正在运行32位Python


Tags: key注册表localsetupsoftwaremachineadobeeffects
1条回答
网友
1楼 · 发布于 2024-05-10 01:21:04

评论中的@martineau正好击中了它的头部!我需要更改访问密钥以允许找到64位注册表

import winreg
i=0
while True:
    try:
        # self.aeKey = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, "SOFTWARE\\Adobe\\After Effects\\16.0")
        key = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\Adobe",0, winreg.KEY_READ | winreg.KEY_WOW64_64KEY)
        assert key != None, "Key = None"
        printTest = winreg.EnumKey(key, i)
        print(printTest)
        i+=1
    except WindowsError:
        break

现在生产

Acrobat Distiller
Acrobat PDFMaker
Adobe Acrobat
Adobe Bridge
After Effects
Animate
Character Animator
CommonFiles
Dreamweaver 2020
Dreamweaver CC 2019
Identity
Licensing
Photoshop
Prelude
Premiere Pro

谢谢你的帮助

相关问题 更多 >