Delete registry key with a CMD script.

CMD PROMPT>reg.exe delete /?

REG DELETE KeyName [/v ValueName | /ve | /va] [/f]

KeyName    [\\Machine\]FullKey
Machine  Name of remote machine – omitting defaults to the current machine.
Only HKLM and HKU are available on remote machines.
FullKey  ROOTKEY\SubKey
ROOTKEY  [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey   The full name of a registry key under the selected ROOTKEY.

ValueName  The value name, under the selected Key, to delete.
When omitted, all subkeys and values under the Key are deleted.

/ve        delete the value of empty value name (Default).

/va        delete all values under this key.

/f         Forces the deletion without prompt.

Examples:

REG DELETE HKLM\Software\MyCo\MyApp\Timeout
Deletes the registry key Timeout and its all subkeys and values

REG DELETE \\ZODIAC\HKLM\Software\MyCo /v MTU
Deletes the registry value MTU under MyCo on ZODIAC

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s