When I invoke my Perl scripts in the Windows environment without invoking perl
first, the parameters are not passed to my script.
For example,
C:\my-perl-scripts\foo.pl bar
invokes foo.pl
, but it doesn't recognize bar
as a parameter (@ARGV
is empty). However,
perl C:\my-perl-scripts\foo.pl bar
works as expected.
Is this a configuration issue?
Ideally, I'd like to be able to distribute some Perl scripts, have the user add C:\my-perl-scripts\
to the path and then just be able to invoke foo.pl
from anywhere while running cmd.
If they have to specify perl
first, then they'll always have to give a complete path.
To show that the assoc and ftype are correct on my system, I executed the following commands.
assoc .pl
Output:
.pl=Perl
And
ftype Perl
Output:
Perl="C:\Perl\bin\perl.exe" "%1" %*
And:
more t.pl
Output:
print "'$_'\n" for @ARGV;
And:
t a b
perl t.pl a b
Output:
'a'
'b'
And (no output):
t.pl a b
I included both the output of t and t.pl to show it's not a %PATHEXT% problem. Both outputted nothing as originally described whereas invoking perl
first gave the expected response.
The problem appears to be on my vista business box. On my Windows XP Pro box, it works as expected. Both have ActivePerl 5.8.9. I have another Windows Vista Home box that I have not yet tried yet.
I found the answer (posted below). I found it by running a registry cleaner, removing the Perl installation, running the registry cleaner again. On the second cleaning, only one invalid entry remained—the one that was causing the problem (probably left over from a previous installation).