36
13
I tried the following experiment.
Before I start, I checked the PATH variable from cmd, which has the following value:
Path=C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\ProgramData\Lenovo\ReadyApps;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Skype\Phone\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Calibre2\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;
At first, I thought that cmd only looks for executables in the directories contained in the PATH variable, so I randomly picked an application - winword.exe (Microsoft Word), and tried to launch it from the command line:
start winword
But to my surprise, the program launches! The reason I'm surprised is because I've searched through all the directories in the PATH variable for the exe file called 'winword' but all my searches came up empty!
I've therefore concluded that the command prompt must have known to search in places other than those specified in the PATH variable to look for executables.
So obviously, the next thing I did was to look for the precise location where the 'winword' executable file is located. It turns out that winword.exe is located here:
C:\Program Files\Microsoft Office 15\root\office15
Hence giving me the idea that maybe CMD automatically looks through ProgramFiles and ProgramFiles(x86) (and all their subdirectories) when executing the 'start' command? Which led to me trying to launch another application installed on my computer, Audacity, with the exe file located at:
C:\Program Files (x86)\Audacity
Again, to my surprise, Audacity failed to launch when I typed:
start audacity
at the command line.
I've then added the directory containing audacity.exe to PATH:
set path=%path%;C:\Program Files (x86)\Audacity
after which i tried launching audacity again:
start audacity
Well, not surprisingly, Audacity launched.
What I want to know is where exactly does the command prompt look for executables? Why is it that winword.exe launches even when the directory containing it not part of PATH, but the same thing isn't true for audacity.exe?
I tried other applications too. Chrome and Firefox works when I use the start command.
UPDATE: I am running Windows version 6.3.9600 (Windows 8.1)
1
The core of in my answer to Kyle Delaney's question from about a year and a half ago addresses this question too.
– TOOGAM – 2018-08-25T06:42:24.310