Solved

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

Posted on 2011-02-11
7
506 Views
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?

From-Command-Prompt.png
From-Run-Command.png
0
Comment
Question by:jdana
7 Comments
 
LVL 5

Expert Comment

by:EnriquePhoenix
ID: 34873046
you need to give it a location where its located
cd Program Files\Microsoft Office\Office12\
excel.exe
0
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 250 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  ...
0
 
LVL 5

Expert Comment

by:EnriquePhoenix
ID: 34873082
This site has a good breakdown on how to modify your enviromental variables

http://www.voidspace.org.uk/python/articles/command_line.shtml
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 1

Expert Comment

by:ragijshah
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.
0
 

Author Comment

by:jdana
ID: 34873250
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
 
LVL 83

Assisted Solution

by:oBdA
oBdA earned 250 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.
0
 

Author Closing Comment

by:jdana
ID: 34882590
oBdA,

Perfect.  Thanks for the info.

J
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
Issue: Unstable cursor in Windows XP and Windows runs extremely slow in that any click will bring up the Hour glass (sometimes for several seconds before giving you what you want) . Troubleshooting Process and the FINAL FIX: This issue see…
In this Micro Tutorial viewers will learn how to use Boot Corrector from Paragon Rescue Kit Free to identify and fix the boot problems of Windows 7/8/2012R2 etc. As an example is used Windows 2012R2 which lost its active partition flag (often happen…
This Micro Tutorial will go in depth within Systems and Security in Windows 7 and will go into detail regarding Action Center, Windows Firewall, System, etc. This will be demonstrated using Windows 7 operating system.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now