Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Perl, Windows 7 and command line arguments

by merrymonk (Hermit)
on Jan 12, 2010 at 15:08 UTC ( [id://816922]=perlquestion: print w/replies, xml ) Need Help??

merrymonk has asked for the wisdom of the Perl Monks concerning the following question:

In Windows XP I use the following association for .pl files so that Perl files with command line arguments work.
\bin\perl.exe %1 %*
I have not got Windows 7 but I am trying to help someone using windows 7.
Are the %1 %* characters required (a test seems to show that they are)
If so how are these added since my contact cannot see how this is done?
Is there any other way of making Perl applications with command line arguments work?/
  • Comment on Perl, Windows 7 and command line arguments

Replies are listed 'Best First'.
Re: Perl, Windows 7 and command line arguments
by cdarke (Prior) on Jan 12, 2010 at 16:29 UTC
    I am using Windows 7 and Windows XP, and the associations are identical. Watch your quotes, in your FTYPE use something like:
    FTYPE perl="C:\Perl\bin\perl,exe" "%%1" %%*
    (The double %% stumpted me for a while)

    I use .bat file shortcuts to run Python and PHP from cmd.exe on both and Windows 7 did not require any changes to the .bat files. I use ActiveState Perl which does the correct ASSOC and FTYPE for me.

    However 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.

    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. Fortunately Windows security for keys (and directories) is based on inheritence, and so keys within that hive will have the same permissions by default.
Re: Perl, Windows 7 and command line arguments
by Anonymous Monk on Jan 12, 2010 at 15:38 UTC
    Tell person to read (from cmd.exe)
    help assoc
    help ftype
    
    perl is used as an example
Re: Perl, Windows 7 and command line arguments
by Burak (Chaplain) on Jan 12, 2010 at 15:36 UTC
    You can just add ;.pl to $ENV{PATHEXT}

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://816922]
Approved by Corion
Front-paged by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (6)
As of 2024-04-19 11:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found