30. marts 2007 - 10:54Der er
1 kommentar og 1 løsning
Hvordan finder man software som er installeret på en pc?
Hvordan er det muligt at finde software som er installeret på en pc? Jeg har en ide om at man skal gennemsøge reg-databasen for det, men hvordan gøre man det eller er der en anden måde man løser det problem på?
In this example, we will fill a TMemo with the names of the applications installed in Windows, and also with the names of the executables that will make their unistall.
Add 'Registry in the uses of your form Put a TMemo (Memo1) and a TButton (Button1) in your form Put this code in the OnClick event of Button1:
var reg : TRegistry; Lista : TStringList; Lista2 : TStringList; i,n : integer;
begin {Creamos cosas temporales} {Create temporal things} reg := TRegistry.Create; Lista := TStringList.Create; Lista2 := TStringList.Create;
{Cargamos todas las subkeys} {Load all the subkeys} with Reg do begin RootKey := HKEY_LOCAL_MACHINE; OpenKey(CLAVE,false); GetKeyNames(Lista); end;
{Cargamos todos los Nombres de valores} {Load all the Value Names} for i := 0 to Lista.Count -1 do begin reg.OpenKey(CLAVE + '\' +Lista.Strings[i],false); reg.GetValueNames(Lista2);
{Mostraremos sólo los que tengan 'DisplayName'} {We will show only if there is 'DisplayName'} n:=Lista2.IndexOf('DisplayName'); if (n <> -1) and (Lista2.IndexOf('UNINSTALLString')<>-1) then begin {DisplayName+UNINSTALLString} Memo1.Lines.Append ( reg.ReadString(Lista2.Strings[n])+'-'+ reg.ReadString(Lista2.Strings[Lista2.IndexOf('UNINSTALLString')]) ); end; end; {Liberamos temporales} {Free temporals} Lista.Free; Lista2.Free; reg.CloseKey; reg.Destroy; end;
Denne løsning finder alt også selv sikkerhedsopdateringer, hvilket jeg ikke har behov for. Men jeg fandt en løsning på en anden måde. Windows selv har en måde at gøre det på:
%systemroot%\system32\wbem\wmic.exe /output:c:\productlog.csv product get name,vendor,version
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.