use Win32::Registry; qx(regedit /s "c:\\Program Files\\Microsoft Office\\Office\\power.reg); $main::HKEY_CURRENT_USER->Open("Software\\Microsoft", $Microsoft) || die "Can't open Software\\Microsoft key: $!\n"; $Eight = MakeTree($Microsoft, "Office\\8.0"); $Eight->GetKeys(\@Eight); foreach $key (@Eight) { $Key->SetValue("Default", REG_SZ, $HomeDir); $Key->GetValues(\%KeyVals); if (%KeyVals) { $KeyVal = $KeyVals{""}; $AutoGrammer = $KeyVals{"AutoGrammar"}; } else { $Key->SetValueEx("AutoGrammar", 0, REG_SZ, "0"); $Key->SetValueEx("Run Already", 0, REG_DWORD, "1"); } # Create multilevel hive structure sub MakeTree { my ($SubTree, $Path) = @_; $Path =~ s#^\\##; my (@KeyList) = split(/\\/, $Path); my $key; my $RegKey = $SubTree; foreach $key (@KeyList) { # print "Key being created is: $key\n"; $RegKey->Create($key, $RegKey) || die "Can't create $key key: $!\n"; } return $RegKey; }
file: /Techref/language/perl/win32reg.htm, 1KB, , updated: 2001/4/25 11:30, local time: 2024/11/22 16:41,
3.144.253.195:LOG IN
|
©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions? <A HREF="http://techref.massmind.org/Techref/language/perl/win32reg.htm"> Perl Win32 Registry</A> |
Did you find what you needed? |
Welcome to massmind.org! |
Welcome to techref.massmind.org! |
.