Joseph Grech
Joseph Grech

Reputation: 33

How to delete a registry root through C#

I've been looking for days for an answer but the only answers I found were to delete registry keys or values.

I apologize if the answer exists but I have tried very hard to find the answer as to not ask a question that has already been answered.

Basically what I need is a way to delete a WHOLE registry folder through C# from the LOCAL_MACHINE\SOFTWARE path. EG: LOCAL_MACHINE\SOFTWARE\ABC , deleting the whole ABC "folder".

Upvotes: 1

Views: 555

Answers (1)

DonBoitnott
DonBoitnott

Reputation: 11025

I think you want:

Microsoft.Win32.Registry.LocalMachine.DeleteSubKey(@"Software\ABC");

Be wary: LOCAL_MACHINE is protected, and without Admin privileges, this is likely to fail.

I wonder if your difficulty in searching is simply terminology. Everything that is not a value is a key. In your words, "folder" equals key. It just a nested structure with values along the way.

Upvotes: 1

Related Questions