0

All the answers I keep finding are for python 2.X, but I use python 3.X. They also keep talking about not working with .exe installed programs.

I need a way to be able to get a list of installed programs, both .exe and .msi (and any other method of installation as well), along side their respective installation paths.

At the moment, this is what I'm using to find things:

import os, string
from os.path import join, getsize
availableDrives = ['%s:' % d for d in string.ascii_uppercase if os.path.exists('%s:' % d)]
for i in range(len(availableDrives)):
    for root, dirs, files in os.walk(availableDrives[i]):
        print(root)
        if "ds.py" in files:
            print('yes')
        else:
            print("No")

For those that don't want to read it, it searches through all folder on every drive. I'm in the middle of making it slightly more fficient, but it is still time consuming and I was wondering if after 6 years (yes, that was when the questions were asked), theres finally a way to get this information?

If so, how? And if possible, could you give me the code for it but explain it as I need it as a small part of a school project.

Cheers all,

Luke

EDIT: I've seen some other resources using cmd to create a text file containing the necessary information. I wouldn't mid using this method if someone could tell me how to do it

tripleee
  • 175,061
  • 34
  • 275
  • 318
  • While there are conventions for how and where to "install" programs, a `.dll` in your home directory is technically an executable, and there is no way programmatically to tell whether it was "installed" or just dumped there when you clicked on something by mistake. – tripleee Dec 15 '17 at 09:57

1 Answers1

0

i think you have first to see files in all the directory that you have to declare because i think ther's not a function to show u all the files. try to look at that: http://stackabuse.com/python-list-files-in-a-directory/ https://www.tutorialspoint.com/python/os_walk.htm

Gianmarco
  • 792
  • 2
  • 14
  • 38