Reads a value from the registry.
|RegRead, OutputVar, RootKey, SubKey [, ValueName]
(Obsolete 5-param method): RegRead, OutputVar, ValueType, RootKey, SubKey [, ValueName]
|OutputVar||The name of the variable in which to store the retrieved value. If the value cannot be retrieved, the variable is made blank and ErrorLevel is set to 1.|
|RootKey||Must be either HKEY_LOCAL_MACHINE, HKEY_USERS, HKEY_CURRENT_USER, HKEY_CLASSES_ROOT, or HKEY_CURRENT_CONFIG (or the abbreviations for each of these, such as HKLM). To access a remote registry, prepend the computer name and a colon, as in this example: \\workstation01:HKEY_LOCAL_MACHINE|
|SubKey||The name of the subkey (e.g. Software\SomeApplication).|
|ValueName||The name of the value to retrieve. If omitted, Subkey's default value will be retrieved, which is the value displayed as "(Default)" by RegEdit.|
ErrorLevel is set to 1 if there was a problem or 0 otherwise.
Currently only the following value types are supported: REG_SZ, REG_EXPAND_SZ, REG_MULTI_SZ, REG_DWORD, and REG_BINARY.
REG_DWORD values are always expressed as positive decimal numbers.
Although no more than 64 KB of data can be read from REG_BINARY values, the other types are unlimited except under Windows 95/98/ME, which have a 64 KB limit for all types (the Win9x registry is not capable of storing larger values).
When reading a REG_BINARY key the result is a string of hex characters. For example, the REG_BINARY value of 01,a9,ff,77 will be read as the string 01A9FF77.
When reading a REG_MULTI_SZ key, each of the components ends in a linefeed character (`n). If there are no components, OutputVar will be made blank. See FileSelectFile for an example of how to extract the individual components from OutputVar. Note: Windows 95 does not support the REG_MULTI_SZ value type.
To retrieve and operate upon multiple registry keys or values, consider using a registry-loop.
For details about how to access the registry of a remote computer, see the remarks in registry-loop.
RegDelete, RegWrite, Registry-loop, IniRead
RegRead, OutputVar, HKEY_LOCAL_MACHINE, SOFTWARE\Microsoft\Windows\CurrentVersion, ProgramFilesDir
MsgBox, Program files are in: %OutputVar%