Trying to understand the difference between an executable call at the Run command versus a command prompt.

If I call the Excel executable (excel.exe) from a command prompt, it doesn’t work (Image 1).  If I call it from the run command, however, it works just fine (Image 2).  Why does the Run command know what to do with excel.exe whereas, the command prompt doesn’t?  In an effort to answer my own question, I started poking around my computer’s Environment Variables.  (I’m running W7 Pro.)  

I took a look at the Path Variable, there’s no hint of C:\Program Files\Microsoft Office (or %programfiles%\Microsoft Office).  

Is there another Environment Variable that the Run command has the privilege of using that the command prompt does not?  Or, does the difference in behavior reside somewhere else?

From-Command-Prompt.png
From-Run-Command.png
jdanaAsked:
Who is Participating?
 
Guy Hengel [angelIII / a3]Connect With a Mentor Billing EngineerCommented:
command prompt only looks in the current folder and in all folders declared by the PATH variable

the RUN command is however explorer integrated tool, which goes much further that this, knows about all installed/registered applications, and hence finds excel.exe, and is able to run it.

remember that command prompt basically is coming from good old DOS  ...
0
 
EnriquePhoenixCommented:
you need to give it a location where its located
cd Program Files\Microsoft Office\Office12\
excel.exe
0
 
EnriquePhoenixCommented:
This site has a good breakdown on how to modify your enviromental variables

http://www.voidspace.org.uk/python/articles/command_line.shtml
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
ragijshahCommented:
This is mainly due to two type of environment variable.

1) User Variable and 2) System Variable.

You can copy Path from System variable to user variable and both will work in same way for you.
0
 
jdanaAuthor Commented:
angelIII,

You mention "registered" applications.  Is that the key?  Does the Run Command know what to do with excel.exe through the OS (Windows 7) and registry values?

J
0
 
oBdAConnect With a Mentor Commented:
The "run" command does not only look in the Path variable (like the command prompt does), but it looks as well under "HKLM\Software\Microsoft\Windows\CurrentVersion\App Paths" if there's a key <application.exe>, and then checks the value below for the location.
0
 
jdanaAuthor Commented:
oBdA,

Perfect.  Thanks for the info.

J
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.