- Open the command prompt of windows
- Type
wmic
- On the wmic prompt type the
output
command followed by the path of the txt file and the command to list the programs. It is going to be like the following:
/output:C:\Users\<yourUser>\Documents\programsInstalled\listOfProgramsInstalledWin10.txt product get name,version
- Wait for the wmic prompt get back to you again and you'll know it has finished listing the files into the txt file
The solution below was gotten from this stackoverflow response.
import winreg
def foo(hive, flag):
aReg = winreg.ConnectRegistry(None, hive)
aKey = winreg.OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall",
0, winreg.KEY_READ | flag)
count_subkey = winreg.QueryInfoKey(aKey)[0]
software_list = []
for i in range(count_subkey):
software = {}
try:
asubkey_name = winreg.EnumKey(aKey, i)
asubkey = winreg.OpenKey(aKey, asubkey_name)
software['name'] = winreg.QueryValueEx(asubkey, "DisplayName")[0]
try:
software['version'] = winreg.QueryValueEx(asubkey, "DisplayVersion")[0]
except EnvironmentError:
software['version'] = 'undefined'
try:
software['publisher'] = winreg.QueryValueEx(asubkey, "Publisher")[0]
except EnvironmentError:
software['publisher'] = 'undefined'
software_list.append(software)
except EnvironmentError:
continue
return software_list
software_list = foo(winreg.HKEY_LOCAL_MACHINE, winreg.KEY_WOW64_32KEY) + foo(winreg.HKEY_LOCAL_MACHINE, winreg.KEY_WOW64_64KEY) + foo(winreg.HKEY_CURRENT_USER, 0)
for software in software_list:
print('Name=%s, Version=%s, Publisher=%s' % (software['name'], software['version'], software['publisher']))
print('Number of installed apps: %s' % len(software_list))
@karanphol I'm not sure if I understood your question. Are you asking about how to reinstall all those those programs listed with the script above? If so, I haven't done that before on Windows, but on other OSs people usually make use of dotfiles to restore their system, like shown at this youtube video.