Skip to main content

`reg_query` is a Python library for querying the Windows Registry to find specified values and keys efficiently.

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reg_query-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

reg_query-0.1.0-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file reg_query-0.1.0.tar.gz.

File metadata

  • Download URL: reg_query-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/10

File hashes

Hashes for reg_query-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4411ffe768e772a5bed0ab37ce4e723cab8e78007600a6e14a63e7a59821395a
MD5 a97670192d8949799b8f745e1ae05752
BLAKE2b-256 70053514ea9978872cf9a1283e1a2b871bf84310044c39e12efb38523f4e1c1b

See more details on using hashes here.

File details

Details for the file reg_query-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: reg_query-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Windows/10

File hashes

Hashes for reg_query-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9eac0a0d3dda4d0d406b0e9dac145fe35cd522f2fddbb5d2602aefd9bc809cd9
MD5 0ec7a17542d47e1de8312e65ec4d3c16
BLAKE2b-256 b1d0097b1633747a74b50db9659c772784cc416afe404e2b18afe8a69c99633e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page