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.1.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: reg_query-0.1.1.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.6 Linux/6.8.0-1014-azure

File hashes

Hashes for reg_query-0.1.1.tar.gz
Algorithm Hash digest
SHA256 83d6002d68ee82773d6842226f56db004c2c0087a49d37e8711c7e81f1f551a5
MD5 2fae912bf90950227e1529c0dc1b49c2
BLAKE2b-256 6874c129b77e3c792571b1b1e41edb0a2c68b185285f6a553b81561488de2fd6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: reg_query-0.1.1-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.6 Linux/6.8.0-1014-azure

File hashes

Hashes for reg_query-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e9cd09a67185f3d77491a00ad9c20972f751c8b645f8e14002c7fbe511c2ba3
MD5 7018b8c1565eda31d385d6bd4debf899
BLAKE2b-256 2767aa01f0e5a95d170b561db6e137adc5894a9ebe43d32de945280d46001488

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