Read winreg by RegRead
Posted: 17 Apr 2020, 12:10
I have no idea why this doesn't work for me.
This is from the manual RegRead (and work)
But this doesn't (the path is copied from RegEdit)
This is from the manual RegRead (and work)
Code: Select all
RegRead, OutputVar, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion, ProgramFilesDir
MsgBox, Program files are in: %OutputVar%
Code: Select all
; vKey := "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Elevate\StoppCommLog-UAC"
; RegRead vExist, %vKey%, Id
RegRead, vExist, HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Elevate\StoppCommLog-UAC, Id
If ErrorLevel ; Should error if no key exists.
{ MsgBox 16, Rad %A_LineNumber% -> %A_ScriptName%,
( LTrim
KEY is missing!`n
ErrorLevel .: %ErrorLevel% `n
%vKey%
)
}
MsgBox % "Result .: " vExist