zoukankan      html  css  js  c++  java
  • python获取软件安装列表2222

    softer_installed_list =====================

    使用python编写的,获取本机软件安装列表,输出为html表格.

    * win7 32位环境下运行

    * 使用的是"**SOFTWAREMicrosoftWindowsCurrentVersionUninstall**"

    下的软件安装列表

    * 生成文件保存为index.html

    * 示例地址:http://sharedoc.sinaapp.com/install-list/

    * gitbhub地址为:https://github.com/urmyfaith/softer_installed_list/

    * 运行不需要参数,双击softer_installed_list.py即可.(需要安装python2.x)

    主要代码:

    ```python key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, r"SOFTWAREMicrosoftWindowsCurrentVersionUninstall", 0, _winreg.KEY_ALL_ACCESS) for i in xrange(0, _winreg.QueryInfoKey(key)[0]-1): try: key_name_under_uninstall=_winreg.EnumKey(key, i) #print key_name_under_uninstall each_key_path="SOFTWAREMicrosoftWindowsCurrentVersionUninstall"+'\'+ key_name_under_uninstall #print each_key_path each_key= _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE,each_key_path,0, _winreg.KEY_ALL_ACCESS) try: softer_ware_name,typeresult= _winreg.QueryValueEx(each_key,"DisplayName") softer_ware_name=softer_ware_name.encode('utf-8')

    try: InstallLocation_name,typeresult= _winreg.QueryValueEx(each_key,"InstallLocation") InstallLocation_name = InstallLocation_name.encode('utf-8') if InstallLocation_name=="": InstallLocation_name="NULL" except WindowsError: InstallLocation_name="NULL" html_table = html_table + html_tr_left_str + str(i+1) + '''''' + softer_ware_name + '''''' + InstallLocation_name + html_tr_right_str except WindowsError: pass except WindowsError: pass

    ```

  • 相关阅读:
    webAPI 控制器(Controller)太多怎么办?
    mysql Unknown error 1054
    .NET MVC项目设置包含Areas中的页面为默认启动页
    EF C# ToPagedList方法 The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must ……
    控制台Main函数传参
    C#编码规范
    Linq扩展方法
    Linq操作ArrayList
    LINQ和文件目录
    LINQ To Objects
  • 原文地址:https://www.cnblogs.com/xilifeng/p/3984654.html
Copyright © 2011-2022 走看看