4

Perl script on Windows 10 can't get command line parameters if command line does not begin with "perl". The same works correctly on Windows7. Please look at example:

D:\>ver

Microsoft Windows [Version 10.0.17763.503]

D:\>assoc .pl
.pl=PerlScript

D:\>ftype PerlScript
PerlScript=D:\x\perl\perl\bin\perl.exe "%1" %*

D:\>type tst.pl
# tst.pl

use strict ;
use warnings ;

print '$0 = '. $0 ."\n" ;
unless( $ARGV[ 0 ] ) { die "No args.\n\n" }
my $i = 0 ;
for my $arg ( @ARGV ) { print $i++ .': '. $arg ."\n" }

D:\>perl tst.pl
$0 = tst.pl
No args.


D:\>perl tst.pl FIRST SECOND
$0 = tst.pl
0: FIRST
1: SECOND

D:\>tst.pl FIRST SECOND
$0 = D:\tst.pl
No args.
Zdenek J
  • 41
  • 2
  • See also [How do I make my Perl scripts act like normal programs on Windows?](https://stackoverflow.com/q/4727480/2173773) – Håkon Hægland Jun 25 '19 at 09:13
  • Yes, I saw the link above. I think this is specific Windows 10 problem. It is ok on Windows7. I tried a new Perl installation from http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit.msi at other PC with Win.10. Test script works OK. – Zdenek J Jul 06 '19 at 18:23
  • So Perl-installation from MSI file is proven OK, but installation from ZIP file with manual settings (assoc, ftype) in the same way, as on Windows7, has any problem (specifics registry settings?). – Zdenek J Jul 06 '19 at 18:32
  • After Perl-installation from MSI file is one PC OK (with 32-bit Windows 10), but second PC is not OK (with 64-bit Windows 10). The same behavior as above. It should be any local problem (?). – Zdenek J Jul 08 '19 at 13:06

0 Answers0