To delete subkeys and values from the Windows registry, use REG delete. REG delete has several different syntaxes. If you want to delete a subkey and all subkeys and entries under the subkey, use the following syntax:
reg delete KeyName
where KeyName is the name of the subkey you want to delete. Although the subkey path can include the UNC name or IP address of a remote computer, a remote source subkey can use only the HKLM or HKU root keys. Consider the following example:
reg delete \\Mailer1\HKLM\SYSTEM\CurrentControlSet\Services\DNS2
Here you delete the DNS2 subkey and all subkeys and entries under the subkey on MAILER1.
If you want to limit the scope of the deletion, specify that only a specific entry under the subkey should be deleted using the following syntax:
reg delete KeyName /v ValueName
where KeyName is the name of the subkey you want to work with and ValueName is the name of the specific entry to delete. As before, the subkey path can include the UNC name or IP address of a remote computer. However, a remote source subkey can use only the HKLM or HKU root keys. In this example, you delete the Description entry for the DNS2 subkey on MAILER2:
reg delete \\Mailer2\HKLM\SYSTEM\CurrentControlSet\Services\DNS2 /v Description