I would just like to know the answer to the title.
Preferably formatted like, {'Some program':'C:\\Program Files\\someprogram\\mainapp.exe'}
I would just like to know the answer to the title.
Preferably formatted like, {'Some program':'C:\\Program Files\\someprogram\\mainapp.exe'}
I think this does what you need...
import subprocess # import subprocess module to run external commands from Python
program_dict = {} # create a dict
installed_programs = subprocess.check_output(['wmic', 'product', 'get', 'name']) #run subprocess module with check_output() method
ip = str(installed_programs) #convert bytes to string
counter = 1
try:
for i in range(len(ip)): #iterate over every program
while True:
counter +=1
program_dict[f'Program {counter}'] = ip.split("\\r\\r\\n")[6:][i]
print(f'Programs found:\n{program_dict}')
except IndexError as error:
print("[-] Something went wrong.\n",error)