type also works provided you do something else first in the same command, or if you use a redirection:

system "cd && type file"; ## or system "ver && type file"; ## or system "type file > CON";

There is code internal to the system function that attempts to decide if it can get away with running the command you've supplied directly as an executable without invoking a copy of the shell. That is, if the command you ask it to run is an executable, then it runs that executable directly, but if it is a cmd.exe built-in command, then it runs cmd.exe with your input as the command line.

One of the ways it make this determination is to scan the path and look to see if there is an executable with the name of the first token you enter. Ie. When you supply "type file", it goes looking through your path looking for "type.exe". If that isn't found, then it will invoke "cmd /c type file", which will probably work.

But if like me you have Unxtools somewhere in your path, then it will find the ever useful and wonderfully named type.exe:

C:\test>U:type.exe -h Usage: U:type.exe -v ==> version U:type.exe -h ==> usage U:type.exe -help ==> help U:type.exe file(s) ==> path to a file(s) C:\test>U:type.exe -help The C:\WINDOWS\System32\UnixTools\type.exe program will display the pa +th to a file if it is in the PATH environmental variable

If you have the same tool in your path, rename it (or just delete it. the 'which' command is better named and more useful) and the problem will go away.


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
"Too many [] have been sedated by an oppressive environment of political correctness and risk aversion."

In reply to Re: Windoze oddity? by BrowserUk
in thread Windoze oddity? by rovf

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.