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
```