Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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 +ut.

Edit kudra, 2002-02-26 Added 'NT' to title per ntc request

Edit by tye to change PRE to CODE when around long lines.


In reply to Win32 Execution: UNiX Style (NT) by emcb

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-20 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found