Question is when cmd.exe is already set in environment variable "ComSpec", why is it not found by "perldoc" ?

Because "cmd.exe" is only the local name of the file. All versions of the Microsoft file systems also need to know which directory "cmd.exe" resides in. That is the function of %PATH%: to list all the directories where the OS should look when it has only the local name.

The value of %PATH% you show appears to be missing the directory where cmd.exe is located. For example, in Vista cmd.exe is located in the C:\Windows\System32 directory. I think this is also true for all of the 32 bit versions of Windows (e.g. 95, 2000, XP), but others can verify this.

The long ugly list of directories that the first few posters said needed to be in PATH are also missing from you %PATH%. They hold not only cmd.exe but several system libraries (DLLs). Many compiled programs only have the local name of the libraries they want and so the MS OSes rely on PATH to find the directory where those libraries are located.

Paths are searched in the same order they are listed so you'll also want those directories to be the first one's on the path. Otherwise, the OS might find first (and use) a program that just happens to be named "cmd.exe" that isn't the one provided by the OS. Once you've added these directories to your path, things should probably work OK.

It may not make sense that Windows doesn't just "know" where these things are located, but that's the way it is.

Best, beth


In reply to Re^3: path for perl by ELISHEVA
in thread path for perl by manish.rathi

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.