in reply to Passing arguments

The file association is a common reason, but there is an issue with them on Windows 7. "Out of the box", the ASSOC command gives "Access is denied", even though the user is an Administrator.

When this happened to me, my first thought was to turn off the dreaded User Account Control settings, but that changed nothing. The eventual solution was to go into regedit and grant my user full control on registry key HKEY_CLASSES_ROOT, which is where the file associations are held.

Replies are listed 'Best First'.
Re^2: Passing arguments
by jsPerl (Novice) on Nov 05, 2010 at 15:35 UTC
    I am sorry not to have provided more detail. I inserted the following at the very beginning of my code which showed me that I am not getting any arguments:

    my $cnt = @ARGV; print "Count=$cnt\n"; print "@ARGV\n"; exit;

    and I got the following when I run it:

    H:\>History-Reader.pl arg1 arg2 arg3
    Count=0

    I also get the following when issuing suggested commands:

    H:\>assoc .pl
    .pl=Perl
    H:\>ftype Perl
    Perl="C:\Perl\bin\perl.exe" "%1" %*

    I TOTALLY DO NOT LIKE WINDOWS, but I have no choice for this program.

    Does anyone have any other suggestions?
      Interesting - If I run the script with "Perl" in front of the filename it works, but not if I run it via its association:
      H:\>Perl History-Reader.pl arg1 arg2 arg3
      Count=3
      arg1 arg2 arg3

      H:\>History-Reader.pl arg1 arg2 arg3
      Count=0

      How can I get it to work without having to prefix "Perl"?