find list of available applications that can open particular type file?

Viewed 114

I am making a program and I want to open a particular file(e.g ".jpg") with available application as Windows shows Open With option on right click.

enter image description here

I tried os.startfile(),but it opens only with default application.Also I found some examples from stackoverflow with same titled but none of them works for Windows in Python.Here are those examples links.

Anyone knows how to do this?

1 Answers

Try to get this information form registry.

HKEY_CLASSES_ROOT

import winreg

access_registry = winreg.ConnectRegistry(None,winreg.HKEY_CLASSES_ROOT)
access_key = winreg.OpenKey(access_registry, r".jpg\OpenWithProgids")

for n in range(20):
   try:
      x = winreg.EnumValue(access_key,n)   
      print(x[0])
   except:
      break

Registry key with commands to start programs from "Open with..."

Related