Computer Hope
Microsoft => Microsoft DOS => Topic started by: zipcool on October 09, 2006, 10:30:27 PM
-
Hi. Just improving my somewhat limited knowledge. What Comes Up When Run Is Typed at the DOS prompt. Run.Exe or Run.Com. And why. Appreciate an answer as I am undertaking a course to improve my cyber IQ.
Fanks
Zipcool ::)
-
To make sure I understand, you are asking which file would be run if you type RUN and you have both a RUN.EXE and a RUN.COM file in the same directory?
If that is the question, then the answer depends on your version of Windows (or DOS). For Windows XP / 2003, the .EXE file would take precedence. For real-mode DOS or Win 9x, and I think 2000, the .COM file would take precedence.
-
Thanks for replying Gary. I'm not assuming there is either a RUN.EXE and a RUN.COM file in the same directory?
I just wanted to know which file would run if I type Run at the DOS command prompt. Would it be the run.exe or run.com?
For real-mode DOS or Win 9x, and I think 2000, the .COM file would take precedence. Why?
Fanks :-?
Zipcool
-
So you are asking which types of files can be run? That also depends on the operating system. With Windows XP, the default file types that can be run without specifying the extension would be .COM, .EXE, .BAT, .CMD, .VBS, .VBE, .JS, .JSE, .WSF, .WSH. So you could have any of the following:
RUN.COM
RUN.EXE
RUN.BAT
RUN.CMD
RUN.VBS
RUN.VBE
RUN.JS
RUN.JSE
RUN.WSF
RUN.WSH
You can look at your PATHEXT environment variable to verify this on your system.
echo %pathext%
-
For real-mode DOS or Win 9x, and I think 2000, the .COM file would take precedence. Why?
Oh, and to answer your other question about precedence ... I think the answer is just because that Bill Gates (Microsoft) decided it should be that way.
http://support.microsoft.com/kb/35284
-
What Comes Up When Run Is Typed. .Exe or .Com. Why
Zipcool ::)
As pointed out, the order of precidence is established by
echo %pathext%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
Why did they choose this particular order rather than another? I don't know if they documented that debate.
I do know that some programs, like BASICA had both a COM and EXE. If you typed BASICA, the COM would get control and then call the EXE. If you removed the COM, then the EXE worked fine anyway. I never understood what the deal was.
But the point is that EXE files tend never to call COM because anything you could do in a COM could easily be added to the EXE. But not vv.
Mac
-
Thankyou both. . com it is. It was a question in an IT test that I had to send in to be marked.
Fanks.
Zipcool :)