reg_query
reg_query is a Python library for querying the Windows Registry to find specified values and keys efficiently.
Installation
PS > pip install reg_query
Usage
Find 7-Zip Install Location from the Registry
This example demonstrates how to find the install location of 7-Zip by querying the Windows Registry.
import winreg
from typing import Callable, Any, Tuple
from reg_query import traverse
def match_displayname(app_name: str) -> Callable[[Any], Tuple[bool, Any]]:
"""Matcher function to find the install location based on display name."""
def matcher(subkey):
value, _ = winreg.QueryValueEx(subkey, "DisplayName")
if app_name.lower() in value.lower():
iloc, _ = winreg.QueryValueEx(subkey, 'InstallLocation')
return True, iloc
return False, None
return matcher
# Specify the registry path for installed applications
reg_path = r'HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall'
# Traverse the registry using the matcher
result = traverse(reg_path, match_displayname('7-Zip'))
if result:
print(f"Found: {result}")
else:
print("Not found.")
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any questions or support, please reach out to me via GitHub Issues.
Metadata
Release files for reg_query 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| reg_query-0.1.1.tar.gz | 3.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| reg_query-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 6.7 kB
Release files / reg_query-0.1.1.tar.gz
| Download URL | reg_query-0.1.1.tar.gz |
|---|---|
| Size | 3.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
83d6002d68ee82773d6842226f56db004c2c0087a49d37e8711c7e81f1f551a5
|
|
BLAKE2b-256 checksum How to use checksums |
6874c129b77e3c792571b1b1e41edb0a2c68b185285f6a553b81561488de2fd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
|
Release files / reg_query-0.1.1-py3-none-any.whl
| Download URL | reg_query-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2e9cd09a67185f3d77491a00ad9c20972f751c8b645f8e14002c7fbe511c2ba3
|
|
BLAKE2b-256 checksum How to use checksums |
2767aa01f0e5a95d170b561db6e137adc5894a9ebe43d32de945280d46001488
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure
|