GetRegValue
- Last UpdatedOct 29, 2026
- 1 minute read
Gets a the value of a variable in the Windows registry.
|
Function |
Group |
Execution |
String Exp. |
Windows |
Windows Embedded |
IoT View |
Thin Clients |
Mobile Access |
|---|---|---|---|---|---|---|---|---|
|
GetRegValue |
System Info |
Synchronous |
Yes |
Supported |
Supported |
Not supported |
Not supported |
Not supported |
Syntax
GetRegValue( numMainKey, strKey, strValueName )
numMainKey
Numeric tag with the following possible values:
|
0 |
HKEY_LOCAL_MACHINE |
|
1 |
HKEY_CLASSES_ROOT |
|
2 |
HKEY_CURRENT_USER |
|
3 |
HKEY_USERS |
|
4 |
HKEY_CURRENT_CONFIG |
|
5 |
HKEY_PERFORMANCE_DATA |
strKey
Path where the value is located in the Main Key.
strVariableName
Name of the variable to get. The maximum length is 255 characters.
Returned value
If the function succeeds, then the function returns the variable value. Otherwise one of the following error codes will be returned:
|
-1 |
Invalid number of parameters or invalid Main Key. |
|
-2 |
Variable type is not supported. You can only read DWord or String values from the registry. |
|
-3 |
Failed to read the variable value; verify that you have the proper security rights. |
Examples
|
Tag Name |
Expression |
|---|---|
|
Tag |
GetRegValue( 0, "HARDWARE\DESCRIPTION\System", "SystemBiosDate" ) // Returned value = "08/14/03" |
|
Tag |
GetRegValue( 2, "Control Panel\Current", "Color Schemes" ) // Returned value = "Windows Standard " |