Loop through values or registry key.. _winreg Python

前端 未结 5 608
清歌不尽
清歌不尽 2021-01-17 21:40

How would I loop through all the values of a Windows Registry Key using the Python module _winreg. I have code that will do what I want, but it is

5条回答
  •  轮回少年
    2021-01-17 22:03

    For iterating through keys and values of registry, you would need EnumKey() and EnumValue() method from _winreg module. Note that these two methods, take index as an argument, and will provide you the key (or value) only for the given index. Therefore, in order to get all the keys (or values) you need to increment the index by one and continue until WindowsError has not encountered.

    This post might help you for a detailed understanding on the same. The Github link for the code can be found in the post.

提交回复
热议问题