Registry Key Deletion : Registry « Win32 « Perl

Home
Perl
1.Array
2.CGI
3.Class
4.Data Type
5.Database
6.File
7.GUI
8.Hash
9.Language Basics
10.Network
11.Regular Expression
12.Report
13.Statement
14.String
15.Subroutine
16.System Functions
17.Win32
18.XML
Perl » Win32 » Registry 
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.