BillyNelson Posted March 20, 2014 Posted March 20, 2014 I am attempting to capture an uninstall string from the registry. So long as I am capturing the values in a key that isn't wrapped in {} it works fine. When it is wrapped in {} it returns blank. $Reg = "HKLM\SOFTWARE\" $var = RegRead($Reg & "Microsoft\Windows\CurrentVersion\Uninstall\{0D94F75A-0EA6-4951-B3AF-B145FA9E05C6}", "UninstallString") MsgBox(4096, "Program files are in:", $var) Any help here would be greatly appreciated.
ripdad Posted March 20, 2014 Posted March 20, 2014 You might have to change: $Reg = "HKLM\SOFTWARE\" to: $Reg = "HKLM64\SOFTWARE\" if you are running a 64 bit OS. "The mediocre teacher tells. The Good teacher explains. The superior teacher demonstrates. The great teacher inspires." -William Arthur Ward
BillyNelson Posted March 20, 2014 Author Posted March 20, 2014 You might have to change: $Reg = "HKLM\SOFTWARE\" to: $Reg = "HKLM64\SOFTWARE\" if you are running a 64 bit OS. I have confirmed that the string is in the 32 bit portion of the registry.
Wilenty Posted March 20, 2014 Posted March 20, 2014 (edited) Hello, I have confirmed that the string is in the 32 bit portion of the registry. if You want read 32bit registry from 64bit, to use: "Wow6432Node" beetween $aKey a $bKey, like: HKLMSOFTWAREWow6432NodeMicrosoftWindowsCurrentVersionUninstall allso read 64bit registry from 32bit app: HKLM64SOFTWAREMicrosoftWindowsCurrentVersionUninstall and my some script for example (works well on both) expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** $search="{*}" $aKey = "HKLM\SOFTWARE" $bKey = "Microsoft\Windows\CurrentVersion\Uninstall\" $timer=TimerInit() $OsArch=StringRight(@OSArch, 2) $script=86 If @AutoItX64 Then $script=64 If $script <> $OsArch Then $aKey = StringRegExpReplace($aKey, "(\\)", "64\\", 1) $AllValues=":X" & $OsArch & @CRLF & ReadValues($aKey & "\" & $bKey) Else $AllValues=":X" & $OsArch & @CRLF & ReadValues($aKey & "\" & $bKey) EndIf If $OsArch = 64 Then $AllValues&=@CRLF & ":X86" & @CRLF & ReadValues($aKey & "\Wow6432Node\" & $bKey) Func ReadValues($hKey) Local $instance=1, $var, $name, $Values While 1 $subKey=RegEnumKey($hKey, $instance) If @error Then ExitLoop $instance+=1 $var = RegRead($hkey & $subKey, "UninstallString") If Not $var Then ContinueLoop $name = RegRead($hkey & $subKey, "DisplayName") $Values&="Name: " & $name & "; String: " & $var & @CRLF & @CRLF WEnd Return $Values EndFunc $Values="" $instance=StringRegExp($AllValues, "(?m)(.*{.*})$|(?m)(:...)$", 3) For $w=0 To UBound($instance)-1 $Values&=$instance[$w] & @CRLF Next $instance=0 $AutoItVer=" AutoIt X" & $script & " Ver: " & @AutoItVersion & " (OsArch: X" & $OsArch & ")" ConsoleWrite($AutoItVer & @CRLF & $AllValues & @CRLF) MsgBox(0,"Time: " & TimerDiff($timer)/1000 & " s."," " & $AutoItVer & @CRLF & $Values & @CRLF) Greetings. P.S. sorry for my poor English Edited March 20, 2014 by Wilenty Marc 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now