Skip to content

Instantly share code, notes, and snippets.

@grepsedawk
Created December 15, 2017 03:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save grepsedawk/8d2bb32374513b92377b35d6ce03f3e4 to your computer and use it in GitHub Desktop.
Save grepsedawk/8d2bb32374513b92377b35d6ce03f3e4 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3 -tt
from winreg import *
def software_path(program_key):
key = OpenKey(ConnectRegistry(None, HKEY_LOCAL_MACHINE), f'SOFTWARE\{program_key}')
for i in range(QueryInfoKey(key)[1]):
try:
subkey = EnumValue(key, i)
if subkey[0] == '':
return subkey[1]
except EnvironmentError:
# handle not found case here
return False
print(software_path('VideoLAN\VLC'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment