Registry Key Deletion : Registry « Win32 « Perl






Registry Key Deletion

   


 use Win32::Registry;

 $key = "SOFTWARE\\yourValue";
 $HKEY_LOCAL_MACHINE->Open($key, $keyList);
 print "Under HKEY_LOCAL_MACHINE\n\tyourValue\n";
 $keyList->GetKeys(\@subKeys);
 $numberOfSubKeys = @subKeys;
 print "\tThere are $numberOfSubKeys keys\n";
 foreach $subKey (@subKeys){
    print "\t\t$subKey\n";
 }
 $key = "newKey";
 print "\nDeleting the $key Key\n";
 if (!$keyList->DeleteKey($key)){
    print "Failed to delete $key\n";
 }
 print "Under HKEY_LOCAL_MACHINE\n\tyourValue\n";
 $keyList->GetKeys(\@newSubKeys);
 $numberOfSubKeys = @newSubKeys;
 print "\tThere are now $numberOfSubKeys key\n";
 foreach $subKey (@newSubKeys){
    print "\t\t$subKey\n";
 }
 $keyList->Close();

   
    
    
  








Related examples in the same category

1.New Registry Key Creation
2.Creates new key in the registry
3.A Registry Branch