I am on Windows 10 using Strawberry Perl version 5.30 and trying to print out the values of the Registry key HKEY_CLASSES_ROOT/Directory/Background/shell/WSL using the Perl module Win32::TieRegistry. Here is a screen shot from the Registry Editor app in Windows 10:
I am using this Perl script to print the value:
use feature qw(say);
use warnings;
use strict;
use Data::Dumper qw(Dumper);
use Win32::TieRegistry( Delimiter=>"/", ArrayValues=>0 );
{
dump_keys("HKEY_CLASSES_ROOT/Directory/Background/shell/WSL");
dump_keys("HKEY_CLASSES_ROOT/Directory/Background/shell/AnyCode");
}
sub dump_keys {
my ($key) = @_;
say "Dumping keys for $key:";
my $tree= $Registry->{$key};
my @keys = keys %$tree;
print Dumper(\@keys);
}
The output is (running from a CMD terminal with adminstration privileges):
>perl p.pl
Dumping keys for HKEY_CLASSES_ROOT/Directory/Background/shell/WSL:
$VAR1 = [];
Dumping keys for HKEY_CLASSES_ROOT/Directory/Background/shell/AnyCode:
$VAR1 = [
'command/',
'/'
];
as seen it prints the AnyCode subkey but not the WSL subkey. I also checked with running reg query from the same CMD:
>reg query HKEY_CLASSES_ROOT\Directory\Background\shell\WSL
HKEY_CLASSES_ROOT\Directory\Background\shell\WSL
(Default) REG_SZ @wsl.exe,-2
Extended REG_SZ
NoWorkingDirectory REG_SZ
So that works fine, but why doesn't the Perl script print the value of the WSL subkey?
