V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
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 · 2019-07-09 18:03:55 +08:00 · 2500 次点击
    这是一个创建于 1745 天前的主题,其中的信息可能已经有所发展或是发生改变。
    请教,python 如何打开注册表编辑器。想获取软件所在注册表的位置,直接打开注册表所在的位置。
    15 条回复    2019-11-29 16:41:31 +08:00
    Humorce
        1
    Humorce  
       2019-07-09 18:16:27 +08:00 via iPhone
    你是要获取还是打开?
    ETiV
        2
    ETiV  
       2019-07-09 18:21:50 +08:00 via iPhone
    loading
        3
    loading  
       2019-07-09 18:22:11 +08:00 via Android
    regedit.exe 似乎没有这个参数,如果需要可能需要第三方注册表工具。
    loading
        4
    loading  
       2019-07-09 18:24:18 +08:00 via Android
    rj2
        5
    rj2  
    OP
       2019-07-10 09:27:54 +08:00
    @Humorce 获取这个键的路径后,直接打开。
    rj2
        6
    rj2  
    OP
       2019-07-10 09:29:32 +08:00
    @ETiV 嗯。regjump.exe 这个也看到了,不太可用
    Humorce
        7
    Humorce  
       2019-07-10 11:13:19 +08:00
    @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
       2019-07-10 11:42:46 +08:00
    @Humorce 完美,谢了。
    rj2
        9
    rj2  
    OP
       2019-07-11 17:49:57 +08:00
    @Humorce 今天试了下,这个思路是感觉是可以的,但是实际打开的是这样的。
    Humorce
        10
    Humorce  
       2019-07-11 18:53:07 +08:00
    @rj2 #9

    没有看到图。
    Humorce
        11
    Humorce  
       2019-07-11 19:20:48 +08:00
    @rj2 #9 忘挂梯子。

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

    实现:
    https://imgur.com/a/z0IWYBb
    rj2
        12
    rj2  
    OP
       2019-07-12 10:38:08 +08:00   ❤️ 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
       2019-07-12 10:50:46 +08:00
    @Humorce 可以的,我手贱,代码忘记修改完。谢了。
    LEORChn
        14
    LEORChn  
       2019-11-19 03:17:11 +08:00
    假设#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  
       2019-11-29 16:41:31 +08:00
    然后,发现第 2 步可以跳过。
    第 3 步改为
    CMD 输入:regscanner.exe /regedit "hkcu\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"
    一样的效果,只能输入 RegEdit 左侧树形列表的路径。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1438 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 17:22 · PVG 01:22 · LAX 10:22 · JFK 13:22
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.