Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

How do you run a perl script without typing the extension on NT?

by hsmyers (Canon)
on Jun 06, 2002 at 19:55 UTC ( #172336=perlquestion: print w/replies, xml ) Need Help??

hsmyers has asked for the wisdom of the Perl Monks concerning the following question: (programs and processes)

How do you make it so that you don't have to type the '.pl' extension when running perl scripts on NT (or W2k or XP)?

Originally posted as a Categorized Question.

  • Comment on How do you run a perl script without typing the extension on NT?

Replies are listed 'Best First'.
Re: How do you run a perl script without typing the extension on NT?
by hsmyers (Canon) on Jun 06, 2002 at 20:21 UTC

    Basically this is a three step process:

    1. ASSOC .pl=PerlScript
    2. FTYPE PerlScript=perl.exe "%1" %*1
    3. set2 PATHEXT=.pl;%PATHEXT%

    1. The double quotes around the '%1' allow there to be spaces in the path to your script. SEE http://aspn.activestate.com/ASPN/Mail/Message/activeperl/1229724

    2. The permanent solution would be to right-click on 'My Computer' and select the 'Environment' tab. A change to 'PATHEXT' there will stick!

    Edit by tye

Re: How do you run a perl script without typing the extension on NT?
by wil (Priest) on Jun 06, 2002 at 20:07 UTC
    You shouldn't have to do this anymore with Perl for Windows, as it automatically updates the Registry, so as long as you name your files with an appropriate extension - .pl or maybe .cgi then Windows should automatically detect these as Perl scripts and just treat your shebang line as a comment.

    However, make sure that you uncomment the following line in your httpd.conf file to ensure that Apache looks up the correct location within the Windows Registry rather than refering to the shebang line.
    ScriptInterpreterSource registry
    This is documented at the Apache website.

    - wil
Re: How do you run a perl script without typing the extension on NT?
by Rich36 (Chaplain) on Jun 06, 2002 at 20:10 UTC
    You can use pl2bat.
    DESCRIPTION
        This utility converts a perl script into a batch file that can be
        executed on DOS-like operating systems. This is intended to allow you
        use a Perl script like regular programs and batch files where you jus
        enter the name of the script probably minus the extension plus any
        command-line arguments and the script is found in your PATH and run.
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://172336]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2021-04-18 19:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?