Home > OS >  How do I list all the installed applications using python?
How do I list all the installed applications using python?

Time:01-08

is there any way to list all the installed application (including MS office applications) in windows OS using python...?

I expect the output as list of applications:

Telegram
Brave
Whatsapp
MS word
& all the applications installed...

CodePudding user response:

There's a python package specifically for that task: https://pypi.org/project/windows-tools.installed-software/

You can install the package by executing pip install windows_tools.installed_software in your terminal and then you just have to import the get_installed_software function and call it accordingly, like so:

from windows_tools.installed_software import get_installed_software

for software in get_installed_software():
    print(software['name'], software['version'], software['publisher'])

CodePudding user response:

As @ekhumoro commented, you can get it from the windows registry. Using python you can try something like this:

import winreg

reg = winreg.ConnectRegistry(None, winreg.HKEY_LOCAL_MACHINE)
key = winreg.OpenKey(reg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall")

for i in range(winreg.QueryInfoKey(key)[0]):
    software_key_name = winreg.EnumKey(key, i)
    software_key = winreg.OpenKey(key, software_key_name)
    try:
        software_name = winreg.QueryValueEx(software_key, "DisplayName")[0]
        print(software_name)
    except Exception as e:
        print(e)
  • Related