1

In Win 7, This is the program:

# TestArg.pl
print "\nin TestArg.pl, \$ARGV[0]=$ARGV[0], \$ARGV[1]=$ARGV[1], \$ARGV[2]=$ARGV[2]"; 

When I run: TestArg.pl 1 2 3 at the command line

I get: in TestArg.pl, $ARGV[0]= 1 2 3, $ARGV[1]=, $ARGV[2]=

Instead of having them distributed.

In the Registry:

HKEY_USERS\...\Software\Classes\pl_auto_file\shell\open\command is:
Default  REG_SZ "C:\Perl\bin\perl.exe" "%1" "%*"

I tried to change REG_SZ to REG_MULTI_SZ, but it wouldn't let me, though I'm the administrator.

Would that have fixed the problem if I could have edited it?

If so, how do I get access?

If it wouldn't have helped, what would?

Keith Thompson
  • 254,901
  • 44
  • 429
  • 631
user1067305
  • 3,233
  • 7
  • 24
  • 29
  • 1
    *"When I run: TestArg.pl 1 2 3 at the command line"* Did you mean `perl TestArg.pl 1 2 3`? – Kenosis Jan 13 '14 at 23:13
  • No, I depended on the file association to know that a program ending in .pl runs with perl.exe. But that's a good question! Since I posted I started playing with the Registry, screwing things up, apparently putting everything back the way it was, but now, the call without the perl.exe in the front passes NO arguments, but the call with the perl.exe works correctly! Does anyone know how all of the registry entries should be set? – user1067305 Jan 13 '14 at 23:29
  • Is this ActiveState Perl? – Borodin Jan 14 '14 at 00:32
  • REG_SZ is what you want – ikegami Jan 14 '14 at 01:17
  • Yes, this is ActiveState Perl. Though I'd be surprised if the problem was with Perl. It seems to be a problem with Windows' Registry. – user1067305 Jan 14 '14 at 04:37
  • Yes, REG_SZ is what it has. I set it to REG_MULTI_SZ and it clobbered it. Anyway, with all my screwing around in the registry, it now works properly if I call it with 'perl' at the start of the command line. But if I call it with just the name of the .pl program, It finds the file, but @ARGV doesn't pick up any of the arguments. It seems to be a problem with the 'file association' setup. – user1067305 Jan 14 '14 at 04:46
  • @user1067305 - The accepted answer at [How do I make my Perl scripts act like normal programs on Windows?](http://stackoverflow.com/questions/4727480/how-do-i-make-my-perl-scripts-act-like-normal-programs-on-windows) will let you successfully `TestArg.pl 1 2 3`. Follow the steps under **Associate *.pl files with perl** – Kenosis Jan 14 '14 at 05:37
  • YES! As you suggested, the question was answered 4 years ago at question 1695188. It requires a %* in the Applications\perl.exe\shell\open\command registry field. I HAD that %*, but only in the pl_auto_file\shell\open\command field. – user1067305 Jan 14 '14 at 23:23

2 Answers2

1

It's suppose to be %*, not "%*"

ikegami
  • 367,544
  • 15
  • 269
  • 518
0

The answer I left in the comments above is too far down the thread to show, so I'll repeat it here, where it can be seen.

As Kenosis suggested, the question was answered 4 years ago at question 1695188.

It requires a %* at the end of the Applications\perl.exe\shell\open\command registry field.

I HAD that %*, but only in the pl_auto_file\shell\open\command field.

It's interesting that whoever is setting that field has been doing it wrong for at least 4 years!

user1067305
  • 3,233
  • 7
  • 24
  • 29