Computer Hope

Microsoft => Microsoft DOS => Topic started by: zipcool on October 09, 2006, 10:30:27 PM

Title: What Comes Up When Run Is Typed. .Exe or .Com. Why
Post 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 ::)
Title: Re: What Comes Up When Run Is Typed. .Exe or .Com.
Post by: GuruGary on October 09, 2006, 10:52:40 PM
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.
Title: Re: What Comes Up When Run Is Typed. .Exe or .Com.
Post by: zipcool on October 10, 2006, 12:01:57 AM
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
Title: Re: What Comes Up When Run Is Typed. .Exe or .Com.
Post by: GuruGary on October 10, 2006, 12:40:48 AM
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.
Code: [Select]
echo %pathext%
Title: Re: What Comes Up When Run Is Typed. .Exe or .Com.
Post by: GuruGary on October 10, 2006, 12:44:23 AM
Quote
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
Title: Re: What Comes Up When Run Is Typed. .Exe or .Com.
Post by: QBasicMac on October 10, 2006, 06:21:26 AM
Quote
What Comes Up When Run Is Typed. .Exe or .Com. Why
Zipcool ::)

As pointed out, the order of precidence is established by
Code: [Select]
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

Title: Re: What Comes Up When Run Is Typed. .Exe or .Com.
Post by: zipcool on October 10, 2006, 06:45:03 PM
Thankyou both. . com it is. It was a question in an IT test that I had to send in to be marked.

Fanks.

Zipcool :)