If your a perl programmer on Windows and find yourself running perl programs from the CLI (Command Line Interface) and get annoyed by having to run perl foo.pl all the time, then this is for you.
You don't have to do this if your running Windows NT 4/5 (2000) because theres a way round it. There are two little programs called assoc and ftype. These programs allow tou to associate the .pl extension or any other extension you use with the perl interpretor. so when you want to run a program called foo.pl you can just type foo at the CLI, as long as its in your CWD (Current Working Directory) or your PATH.
All you will need to do is follow these steps.
1) Open up a CLI. and enter these commands:
C:\> assoc .pl=PerlScript
C:\> ftype PerlScript=C:\Path\To\Perl\bin\perl.exe %1 %*
2) While still in the CLI type this:
C:\> set PATHEXT=.pl;%PATHEXT%
The PATHEXT environment variable contains the extension(s) to executables. So by adding .pl to this anything (files) found with the .pl extension will be treated as executable. This will only last for your CLI session, so if you want to make this a permanent thing do the following:
1) Right click on 'My Computer' and select properties.
2) Move along to the Advanced tab.
3) Click on Environment Variables.
4) In the System Variables double click on PATHEXT.
5) Append a ';.pl' to the end or a '.pl;' to the beggining of the Vari
+able value box.
6) Click on all of the OK's and Apply's, restart your CLI and try it o
Added 'NT' to title per ntc request
Edit by tye to change PRE to CODE when around long lines.
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:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- 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
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||