Reads a value from the registry.
RegRead "keyname", "valuename"
Parameters
keyname | The registry key to read. |
valuename | The value to read. |
Return Value
Success: | Returns the requested registry value value.. |
Failure: | Returns numeric 1 and sets the oAutoIt.error flag: |
1 if unable to open requested key | |
-1 if unable to open requested value | |
-2 if value type not supported |
Remarks
A registry key must start with "HKEY_LOCAL_MACHINE" ("HKLM") or "HKEY_USERS" ("HKU") or "HKEY_CURRENT_USER" ("HKCU") or "HKEY_CLASSES_ROOT" ("HKCR") or "HKEY_CURRENT_CONFIG" ("HKCC").
Related
RegDelete, RegWrite, StringSplit
Example
Set oAutoIt = WScript.CreateObject("AutoItX3.Control")
var = oAutoIt.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion", "ProgramFilesDir")
WScript.Echo "Program files are in:" & var