Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

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

( #172336=categorized question: print w/ replies, xml ) Need Help??
Contributed by hsmyers on Jun 06, 2002 at 19:55 UTC
Q&A  > programs and processes


Description:

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)?

Answer: How do you run a perl script without typing the extension on NT?
contributed by hsmyers

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

Answer: How do you run a perl script without typing the extension on NT?
contributed by wil

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
Answer: How do you run a perl script without typing the extension on NT?
contributed by Rich36

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.

Please (register and) log in if you wish to add an answer



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (10)
    As of 2014-07-11 05:27 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (219 votes), past polls