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

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=categorized question: print w/replies, xml ) Need Help??
Contributed by hsmyers on Jun 06, 2002 at 19:55 UTC
Q&A  > 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)?

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%

1. The double quotes around the '%1' allow there to be spaces in the path to your script. SEE

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.

    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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others chanting in the Monastery: (7)
    As of 2018-07-19 11:55 GMT
    Find Nodes?
      Voting Booth?
      It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

      Results (406 votes). Check out past polls.