赞
踩
使用python脚本获取本机安装的所有软件的信息,并保存到本地
import os import winreg def get_installed_apps(): apps = [] with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, r"SOFTWARE\\Microsoft\Windows\\CurrentVersion\\Uninstall") as key: for i in range(0, winreg.QueryInfoKey(key)[0]): subkey_name = winreg.EnumKey(key, i) with winreg.OpenKey(key, subkey_name) as subkey: try: app_name = winreg.QueryValueEx(subkey, "DisplayName")[0].encode('utf-8') if app_name not in apps: apps.append(app_name) except OSError: pass return apps app_list = get_installed_apps() with open(os.path.join(os.getcwd(), 'app_list.txt'), "w") as f: for i in app_list: f.write("{}\n".format(i))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。