in reply to Ftype/Associate
use strict; use warnings; use Win32::TieRegistry 0.20 (Delimiter=>"/"); sub get_file_association ($) { my $x= shift; my $reg= $Registry->{"HKEY_CLASSES_ROOT/$x//"} or return; # this usually refers to another entry. $reg &&= $Registry->{"HKEY_CLASSES_ROOT/$reg//"} if $x =~ /^\./; return $reg; } # print get_file_association ('.chm'); example usage (include the dot +) foreach (@ARGV) { print $_, '=>', (get_file_association($_) || "NOT KNOWN"), "\n"; }
#!perl -w use strict; use Win32::TieRegistry ( FixSzNulls => 1 ); my $Classes= $Registry->{"Classes\\"}; my @keynames= $Classes->SubKeyNames(); my @list0= grep { lc($Classes->{"$_\\"}->GetValue('')) eq 'intermediat +e file' } @keynames; my (@list1, @list2); foreach (@list0) { if (/^\./) { push @list2, $_; } else { push @list1, $_; } } my $matchexp= join ("|", map{"^\Q$_\E\$"}(@list1)); $matchexp= qr($matchexp); push @list2, grep { /^\./ && lc($Classes->{"$_\\"}->GetValue('')) =~ / +$matchexp/ } @keynames; print join ("\n", @list2);
|
|---|