I want to delete folder PackG3EGM and all its sub directory using c# but I am unable to delete it I don't know what's problem in my code below is my code
string keyName = @"Software\PackG3EGM";
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(keyName, true))
{
key.DeleteSubKeyTree("G3EGM", false);
}
You need to open Software and specify PackG3EGM as the subkey to delete.
Also pass true to the throwOnMissingSubKey param, this will raise an exception if the specified subkey cannot be found
string keyName = @"SOFTWARE";
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(keyName, true))
{
key.DeleteSubKeyTree("PackG3EGM", true);
}