getRegistryValue {SWinRegistry} | R Documentation |
Get the value of a specific, individual key in the registry. This key is assumed to have a value rather than being merely a container key for other sub-keys.
getRegistryValue(path, key, isError = TRUE, top = .BuiltinKeys[1])
path |
the path to the specified node in which the
actual key is located.
The path can be specfied in a variety of ways.
It can be a single string with nodes in the path separated
by the \\ character (e.g. Control Panel\\Appearance\\Schemes ).
Alternatively, it can be given as a character vector
containing the elements of the path as individual
elements of the character vector.
This separates the elements of the path in the same way that
the \\ character does.
In either cases,
the top-level key can be specified within this path
or alternatively can be given by the top argument.
Using the top argument makes it easier to use the
built-in keys in the registry.
And one can specify these by partial matching of the names
or by numeric index into the .BuiltinKeys
vector.
|
key |
the name of the key whose value is to be retrieved. If this is not specified, the key is taken to be the last element of path. |
isError |
a logical value that indicates whether to throw an error
if the key does not exist, or simply return a missing value.
This allows the caller to avoid having to first check if the key exists
or handle the error with a call to try .
|
top |
the identifier of the top-level key in which to resolve
the path argument.
This can be omitted if the top-level node is included in the path
argument.
This can be a name that partially matches those in the
.BuiltinKeys vector or alternatively
the index of the entry in this vector.
This is used as a convenience interface to
minimize typing.
|
This calls the C-level API routine
RegQueryValueEx
.
The conversion from the registry value to an S object
is done according to the following mapping of the types:
The value from the key converted to an S object.
Duncan Temple Lang <duncan@wald.ucdavis.edu>
http://www.omegahat.org/SWinRegistry
getRegistryKeyValues
getRegistrySubKeyNames
getRegistryValue("Control Panel\\Current", "Color Schemes", top = "HKEY_CURRENT_USER") setRegistryValue("HKEY_CURRENT_USER\\Volatile Environment\\duncan", value = "foobar") getRegistryValue("HKEY_CURRENT_USER\\Volatile Environment", "duncan") ## Not run: getRegistryValue("SNormal\CLSID\") [1] "{C484D2F9-21F5-49AC-8C8D-2007E12245D3}" getRegistryValue("SNormal\CLSID", "") [1] "{C484D2F9-21F5-49AC-8C8D-2007E12245D3}" getRegistryValue(c("SNormal", "CLSID"), "") [1] "{C484D2F9-21F5-49AC-8C8D-2007E12245D3}" getRegistryValue(c("SNormal", "CLSID", "")) [1] "{C484D2F9-21F5-49AC-8C8D-2007E12245D3}" ## End(Not run)