I don't know about NT5, but in NT4 associating .pl files to perl does not get the arg list passed to perl. I think there is some syntax you can use when you set up the association.

In DOS, IIRC, the numbered variables $1 $2 and so on are the command line args. Note that $0 is the name of the command.

The batch wrappers use this to work. They generally call perl and have it read in and execute $0 with $1 etc as args. Look inside them for help, there may be a general arg list DOS variable, but I don't know what it is..

You may just want to buy/get a unix shell for windows. I use MKS toolkit at work. The main thing I like about it (I almost never use its shell) is that I get many of the unix command I know and love while I am in dos-hell. Just the addition of a decent more is a wonderful thing...

UPDATE: PiEquals3 is quite right about the variables. Use %1, etc. for batch files. I just discovered that %* is all the args. Which language am I using?

REM foo.bat echo %* REM End of foo.bat c:\foo bar baz bar baz

So, I just tried switching my .pl association to 'c:\perl\bin\perl.exe %0 %*'. It seems fine so far.


TGI says moo


In reply to Re: Re: unix to windows? by TGI
in thread unix to windows? by Anonymous Monk

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



  • 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, details, 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, summary, 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.