Re: jak sprawdzic zainstalowane programy z linii polecen?

Autor: Paweł Goleń <p_golen_at_ks.onet.pl>
Data: Mon 23 May 2005 - 21:49:24 MET DST
Message-ID: <d6tcdi$s8q$1@nemesis.news.tpi.pl>
Content-Type: text/plain; charset=ISO-8859-2; format=flowed

Radosław Sokół wrote:

> No i właśnie dlatego napisałem o tym, że ilu programistów, tyle
> sugestii ;)

A co sobie będę żałował :)

from win32api import \
RegOpenKey,RegCloseKey,RegQueryValueEx,RegQueryInfoKey,RegEnumKey
from win32con import HKEY_LOCAL_MACHINE

programs = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"

hKey = RegOpenKey(HKEY_LOCAL_MACHINE,programs)
i = 0
scount,vcount,mtime = RegQueryInfoKey(hKey)
for i in range(0,scount):
     subkey = RegEnumKey(hKey,i)
     tmpkey = "%s\\%s"%(programs,subkey)
     hTmpKey = RegOpenKey(HKEY_LOCAL_MACHINE,tmpkey)
     try:
         name,type = RegQueryValueEx(hTmpKey,"DisplayName")
         print name
     except:
         pass
     RegCloseKey(hTmpKey)
RegCloseKey(hKey)

-- 
Paweł Goleń
mailto:p_golen@ks.onet.pl
"Wszyscy przecież wiemy, że nikt nie dostaje żadnych spamów" - mój trol
UGVybCBTVUNLUw==
Received on Mon May 23 21:50:13 2005

To archiwum zostało wygenerowane przez hypermail 2.1.8 : Mon 23 May 2005 - 22:42:06 MET DST