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

    ```

  • 相关阅读:
    【LeetCode】96.Unique Binary Search Trees
    【LeetCode】136.Single Number
    VirtualBox下Linux加载Windows的共享目录
    Macbook上Windows的触摸板设置工具
    [转]太岁三煞五黄
    [转]UI、GUI、UE、UX、ID、UED、UCD的区别
    紫微斗数:命主和身主
    [转]如何降低二手烟的危害
    [转]从第六十三卦到第六十四卦
    Mac显示和隐藏隐藏文件
  • 原文地址:https://www.cnblogs.com/xilifeng/p/3984654.html
Copyright © 2011-2022 走看看