Re: path for perl
by Bloodnok (Vicar) on Feb 20, 2009 at 00:51 UTC
|
You could have set the path in one line:
set path=%windir%\system32;%windir%;%windir%\system32\Wbem;C:\Perl\bin
+\
As for Wbem, it's some windoze thing ... as indeed is the requirement for the majority of so many paths
Which is better ? Hmmm, the answer to that depends on whether, as you yourself suggest, you need the environment to be permanent.
BTW, you forgot to include the error you were getting when attempting to run perldoc...
A user level that continues to overstate my experience :-))
| [reply] [d/l] [select] |
|
|
Main question is still answered. When "path=C:\perl\bin" is already s
+et in the environment variable, why do I get such an error. Why do I
+need to set other path as asked in the post
Here is the error I get
C:\perlfiles>perldoc perldoc
Can't spawn "cmd.exe": No such file or directory at C:/Perl/lib/Pod/Pe
+rldoc.pm l
ine 1515.
Can't spawn "cmd.exe": No such file or directory at C:/Perl/lib/Pod/Pe
+rldoc.pm l
ine 1515.
Can't spawn "cmd.exe": No such file or directory at C:/Perl/lib/Pod/Pe
+rldoc.pm l
ine 1515.
| [reply] [d/l] |
|
|
| [reply] [d/l] [select] |
|
|
You get that error because the perldoc script uses the 'more' command of the DOS command line shell (cmd.exe) to show you the perldoc. So cmd.exe has to be in the PATH too as well as any other program perldoc might need.
I don't know much about perl or shells on windows, but you might check if PATH (or path) already has a nice collection of paths before you overwrite it with 'path=...', so you might check that and just add the perl path to it instead of overwriting
| [reply] |
|
|
Something's very wrong if cmd.exe isn't in the PATH. It should be in %windir%\system32. Either the PATH in effect isn't what you think it is, or your Windows install is broken.
| [reply] [d/l] [select] |
|
|
| [reply] [d/l] [select] |
Re: path for perl
by Anonymous Monk on Feb 20, 2009 at 07:30 UTC
|
Once I have set path=C:\perl\bin , in environment variable, do I need
to set any other path ?
Like you were already told, setting path to C:\perl\bin was a mistake. %PATH% is not empty, and you cannot replace it with C:\perl\bin, you can however add C:\perl\bin to the path, which is what you should have done.
| [reply] |
|
|
Sorry about that improper wordings.
Actually C:\perl\bin is added to PATH. Here is the result of "set path"
"C:\perlfiles>set path
PATH=C:\Perl\bin;C:\Program Files\java\jdk1.6.0_11\jre\bin;C:\Program Files\DivX
\DivX Player\DivX Player.exe;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH"
Question is when cmd.exe is already set in environment variable "ComSpec", why is it not found by "perldoc" ? Is it supposed to be set in any other environment variable ?
If thats the case, then whenever any program is using cmd.exe, it will give the same error, right ?
| [reply] |
|
|
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
| [reply] [d/l] [select] |