How to remove a inserted tree from registry using command line?

1

I am have imported .reg file to registry using command line utility (as admin).

regedit /s myregfile.reg

To remove MyTree I have used following command but it does not work.

regedit [-HKEY_LOCAL_MACHINE\MyTree] // suppose to remove MyTree

Can anybody suggest me solution to it?

ashish

Posted 2010-01-08T10:07:57.283

Reputation: 177

Answers

4

reg delete HKLM\MyTree should do it.

Phoshi

Posted 2010-01-08T10:07:57.283

Reputation: 22 001

3

To add to the answer:

regedit, when in import mode, always takes a file name. So giving it "[-HKLM\MyTree]" will not work unless you happen to have a valid Registry file named that. So you would need to create a temporary file and import it (unfortunately, there's no direct equivalent to /dev/stdin in Windows), like a file with the following contents (always a blank line after the first):

REGEDIT4

[-HKEY_LOCAL_MACHINE\MyTree]

(Using the reg command is a lot better. But this may be helpful for when it's not available.)

user1686

Posted 2010-01-08T10:07:57.283

Reputation: 283 655