I uses several CLI tools such as curl
, ipcalc
, perl
, php
, wget
, etc.
When opening a command prompt either via the Start menu or "Run..." > cmd
I can invoke theses tools just by giving their name:
Microsoft Windows [version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\cduv>wget
wget: missing URL
Usage: wget [OPTION]... [URL]...
Try `wget --help' for more options.
C:\Users\cduv>php
^C
But I've noticed that when using a command prompt opened via the native "Open command window here" entry of the SHIFT-down contextual menu it doesn't works.
Microsoft Windows [version 6.1.7600]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\cduv>wget
'wget' not recognized as an internal or external command,
operable program or batch file.
C:\Users\cduv>php
'php' not recognized as an internal or external command,
operable program or batch file.
PATH environment variable seems OK (otherwise I couldn't run executables as shown in the first example).
Is there an explanation to such a difference? How can I fix the "Open command window here" console?
(I'm using Windows 7)
EDIT:
%PATH% content on standard console:
C:\Users\cduv>echo %PATH%
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\ActivePerl 5.14.2.1402\site\bin;C:\Program Files\ActivePerl 5.14.2.1402\bin;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\PHP 5.5.5\ext;C:\Program Files (x86)\PHP 5.5.5;C:\Program Files (x86)\PsTools 2.44;C:\Program Files (x86)\wget 1.11.4;C:\Program Files\cURL 7.23.1;C:\Program Files\TortoiseGit 1.7.15.0\bin;C:\Drivers\AMD Catalyst Suite 13.1\ATI.ACE\Core-Static;C:\Program Files\Slik Subversion 1.8.3-1\bin
%PATH% content on "Open command window here" console:
C:\>echo %PATH%
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\ActivePerl 5.14.2.1402\site\bin;C:\Program Files\ActivePerl 5.14.2.1402\bin;%CommonProgramFiles%\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;%ProgramFiles(x86)%\PHP 5.5.5\ext;%ProgramFiles(x86)%\PHP 5.5.5;%ProgramFiles(x86)%\PsTools 2.44;%ProgramFiles(x86)%\wget 1.11.4;%ProgramFiles%\cURL 7.23.1;%ProgramFiles%\TortoiseGit 1.7.15.0\bin;C:\Drivers\AMD Catalyst Suite 13.1\ATI.ACE\Core-Static;%ProgramFiles%\Slik Subversion 1.8.3-1\bin
By using Process Explorer (from Sysinternals) I can tell which command line were used to open command prompt
Via Start menu or Run prompt:
"C:\Windows\system32\cmd.exe"
(Parent tree: explorer.exe > cmd.exe)
Via "Open command window here":
"cmd.exe" /s /k pushd "C:\"
(Parent tree: wininit.exe > services.exe > svchost.exe > explorer.exe > cmd.exe)
run -> cmd.exe
and fromopen Command prompt here
.wget
&c. aren't in any directory that's a member of your path, how are you executing them even in the successful case? Put it this way: If you don't edit your question to show the output ofecho %PATH%
for shells started both ways, no one who tries to answer your question is going to be able to get past thinking "Well, the paths must be different somehow...", so adding that information greatly increases your chances of getting a helpful answer, without any corresponding drawback. May as well go ahead and do it, don't you think?%ProgramFiles(x86)%
instead ofC:\Program Files (x86)
as in the (working) standard console).