<readregistry> Task

# <readregistry>

Reads a value or set of values from the Windows Registry into one or more NAnt properties.

### Parameters

Attribute | Type | Description | Required
--- | --- | --- | ---
key | string | The registry key to read, including the path. | True
hive | string | Space separated list of registry hives to search for `key`. For a list of possible values, see RegistryHive. The default is `LocalMachine`. | False
prefix | string | The prefix to use for the specified registry key values. If this attribute is used then all registry values will be read and stored as properties with this prefix. | False
property | string | The property to set to the specified registry key value. If this attribute is used then a single value will be read. | False
failonerror | bool | Determines if task failure stops the build, or is just reported. The default is true. | False
if | bool | If true then the task will be executed; otherwise, skipped. The default is true. | False
unless | bool | Opposite of `if`. If false then the task will be executed; otherwise, skipped. The default is false. | False
verbose | bool | Determines whether the task should report detailed build log messages. The default is false. | False

### Examples

- Read a single value from the registry.

      <readregistry property="sdkRoot" key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRoot" hive="LocalMachine" />

  Read all the registry values in a key.

      <readregistry prefix="dotNetFX" key="SOFTWARE\Microsoft\.NETFramework\sdkInstallRoot" hive="LocalMachine" />

### Requirements

Assembly: NAnt.Win32Tasks (0.92.4543.0)