推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
rj2
V2EX  ›  Python

注册表编辑器怎么快速打开某个键

  •  
  •   rj2 · Jul 9, 2019 · 3215 views
    This topic created in 2520 days ago, the information mentioned may be changed or developed.
    请教,python 如何打开注册表编辑器。想获取软件所在注册表的位置,直接打开注册表所在的位置。
    15 replies    2019-11-29 16:41:31 +08:00
    rzti483NAJ66l669
        1
    rzti483NAJ66l669  
       Jul 9, 2019 via iPhone
    你是要获取还是打开?
    ETiV
        2
    ETiV  
       Jul 9, 2019 via iPhone
    loading
        3
    loading  
       Jul 9, 2019 via Android
    regedit.exe 似乎没有这个参数,如果需要可能需要第三方注册表工具。
    rj2
        5
    rj2  
    OP
       Jul 10, 2019
    @Humorce 获取这个键的路径后,直接打开。
    rj2
        6
    rj2  
    OP
       Jul 10, 2019
    @ETiV 嗯。regjump.exe 这个也看到了,不太可用
    rzti483NAJ66l669
        7
    rzti483NAJ66l669  
       Jul 10, 2019
    @rj2 #5

    1、kill regedit
    2、修改 HKCU\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit 下 LastKey 的值为指定路径
    3、start regedit

    参考:
    https://docs.python.org/3/library/winreg.html
    rj2
        8
    rj2  
    OP
       Jul 10, 2019
    @Humorce 完美,谢了。
    rj2
        9
    rj2  
    OP
       Jul 11, 2019
    @Humorce 今天试了下,这个思路是感觉是可以的,但是实际打开的是这样的。
    rzti483NAJ66l669
        10
    rzti483NAJ66l669  
       Jul 11, 2019
    @rj2 #9

    没有看到图。
    rzti483NAJ66l669
        11
    rzti483NAJ66l669  
       Jul 11, 2019
    @rj2 #9 忘挂梯子。

    应该是 LastKey 的值设置出现问题了。

    实现:
    https://imgur.com/a/z0IWYBb
    rj2
        12
    rj2  
    OP
       Jul 12, 2019   ❤️ 1
    @Humorce
    #获取软件的 key 值
    KeyPath = self.numreg[1][key]['KeyPath']
    key_pa ="Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"
    key = win32api.RegOpenKey(win32con.HKEY_CURRENT_USER,key_pa,0, win32con.KEY_ALL_ACCESS)
    #给 Lastkey 的键添加键值
    win32api.RegSetValueEx(key,"LastKey",0,win32con.REG_SZ,KeyPath)
    os.system('regedit')

    查看了下赋值是正确的。打开就只是上面回复图。
    rj2
        13
    rj2  
    OP
       Jul 12, 2019
    @Humorce 可以的,我手贱,代码忘记修改完。谢了。
    LEORChn
        14
    LEORChn  
       Nov 19, 2019
    假设#12 那个位置是你想打开的,
    1.下载 http://www.nirsoft.net/ 的 RegScanner
    2.在文件菜单勾选 “支持 Reg:链接”
    3.CMD 输入 start reg:hkcu\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit

    注:它只能自动帮你选中 REGEDIT 左侧树形列表,第 3 步调用时勿带 [LastKey]
    LEORChn
        15
    LEORChn  
       Nov 29, 2019
    然后,发现第 2 步可以跳过。
    第 3 步改为
    CMD 输入:regscanner.exe /regedit "hkcu\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"
    一样的效果,只能输入 RegEdit 左侧树形列表的路径。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   968 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 45ms · UTC 21:51 · PVG 05:51 · LAX 14:51 · JFK 17:51
    ♥ Do have faith in what you're doing.