new install of Window 11 Pro
when running a perl script from command line and passing $ARGV[0]… the argument doesn’t get passed.
running: perl test.pl “one two” works fine
running: test.pl “one two” doesn’t show arguments.
Tried:
assoc .pl=PerlScript
ftype PerlScript= C:\Users\Owner\AppData\Local\activestate\cache\bin\perl.exe “%1” %*
still at cmd prompt the script will not get $ARGV[0] passed to it.
at this point… I’m at a wits end. cleared the assoc .pl and the ftype.
What do I need to do?
Hi
The state tool and our current installers don’t support this any longer, so if you really want to do this it has to be worked out from first principles. The assoc and ftype commands sit on top of the related registry entries, which are probably set by a older version of ActivePerl, and in some cases, were not set properly or have conflicting settings between global and per-user values.
Actual behavior on the system is determined by the registry key
HKEY_CLASSES_ROOT\Applications\perl.exe\shell\open\command
It should have a (Default)
string value of "C:\Perl\bin\perl.exe" "%1" %*
You might find that it is set to "C:\Perl\bin\perl.exe" "%1"
That should clear up the problem, but you may also have to work through all of your user specific registry settings, so that they don’t override the system default.
I think generally you will find that many advanced users of Perl will recommend that work flows should be consistent on all operating systems, and should avoid assumptions, and that the perl myprog.pl from the command line should be how code is run so that you can be sure to see any warnings and error messages the code produces.
This was a fresh install of Win 11 pro… no other installs of Perl until this current version.
BUT !.. searched the registry for “perl.exe”. I found 4 instances of “%1” … changed those to “%1” %*
Worked!!
BIG thanks! I’ve been doing Perl now for about 15yrs and must have at least 200 scripts on this new box.
We’re so glad you got it working!