Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


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

Posted on 2011-02-11
Medium Priority
Last Modified: 2012-05-11
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?

Question by:jdana
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Expert Comment

ID: 34873046
you need to give it a location where its located
cd Program Files\Microsoft Office\Office12\
LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 1000 total points
ID: 34873050
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  ...

Expert Comment

ID: 34873082
This site has a good breakdown on how to modify your enviromental variables
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.


Expert Comment

ID: 34873162
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.

Author Comment

ID: 34873250

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?

LVL 85

Assisted Solution

oBdA earned 1000 total points
ID: 34873317
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.

Author Closing Comment

ID: 34882590

Perfect.  Thanks for the info.


Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Assume you have an outside contractor who comes in seasonally or once a week to do some work in your office, but you only want to give him access to the programs and files he needs and keep all other documents and programs private. Can you do this o…
On some Windows 7 (SP1) computers, Windows Update becomes super slow even the computer is reasonably fast.  There's one solution that seemed to have worked well for me (after trying a few other suggested solutions).
This Micro Tutorial will teach you how to the overview of Microsoft Security Essentials. This is a free anti-virus software that guards your PC against viruses, spyware, worms, and other malicious software. This will be demonstrated using Windows…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question