Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 535
  • Last Modified:

Delete registry subkey tree

I want to delete a registry subkey tree ONLY if it exists.  How do I tell if it exists?
0
rmmarsh
Asked:
rmmarsh
  • 2
1 Solution
 
Dov_LandauCommented:
See the code below.
if the key does not exists regKey will become null.

Regards,

Dov

RegistryKey regKey = Registry.LocalMachine.OpenSubKey("Software\\SomeBranch\\SomeSubBranch");

Open in new window

0
 
Dov_LandauCommented:
So if you want to delete the tree i showed - all you have to do is check whether it exists and then call DeleteSubKeyTree.
Regards,
Dov
0
 
rmmarshAuthor Commented:
Thank you...
0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now