Jump to content

show registry data for each value in Subkeys loop !!


Recommended Posts

hello there ....

sorry for my bad english ....

im trying to write script this script read all Subkeys  in : HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\ 

and then show them in console ,,, this is my code and it's working 

#pragma compile(Console, True)
#include <MsgBoxConstants.au3>

lena()
Func lena()

For $i = 1 to 100
    $sSubKey = RegEnumKey("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\", $i)



    If @error Then ExitLoop
    ConsoleWrite($sSubKey & @CRLF)

Next

EndFunc

now i need to modify my code to read this value : DisplayName for each subkey in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\  and show here data next to $sSubKey like this 

{1F1C2DFC-2D24-3E06-BCB8-725134ADF989} || display name : (Java 8 Update 131 )

can u help me ... please

Edited by hani-dev
Link to comment
Share on other sites

  • Moderators

Something like this, perhaps, to get you started:

Local $sKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

For $i = 1 to 100
    $sSubKey = RegEnumKey($sKey, $i)
        If @error Then
            ExitLoop
        Else
            $sVal = RegRead($sKey & $sSubKey, "DisplayName")
            ConsoleWrite($sSubKey & "||" & $sVal & @CRLF)
        EndIf
Next

 

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

53 minutes ago, JLogan3o13 said:

Something like this, perhaps, to get you started:

Local $sKey = "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"

For $i = 1 to 100
    $sSubKey = RegEnumKey($sKey, $i)
        If @error Then
            ExitLoop
        Else
            $sVal = RegRead($sKey & $sSubKey, "DisplayName")
            ConsoleWrite($sSubKey & "||" & $sVal & @CRLF)
        EndIf
Next

 

thanx u dear it's working ... but there are some value's that dont have displayname is there anyway to ignore them and just show the keys that have the displayname value ?

Edited by hani-dev
Link to comment
Share on other sites

  • Moderators

Yes, try an If statement:

$sVal = RegRead($sKey & $sSubKey, "DisplayName")

If $sVal <> "" Then
    ...
Else
    ...
EndIf

I'll let you fill in the particulars.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...