Computer Help forum

General discussion

Which executable file will run first??

hi guyz,

my question is that i have three files with same name in same folder zeeshan.bat, zeeshan.exe and now i go to this folder n on command prompt i type zeeshan and press enter. while file has higher priority n will run first n y? please guide me on this topic


Discussion is locked
You are posting a reply to: Which executable file will run first??
The posting of advertisements, profanity, or personal attacks is prohibited. Please refer to our CNET Forums policies for details. All submitted content is subject to our Terms of Use.
Track this discussion and email me when there are updates

If you're asking for technical help, please be sure to include all your system info, including operating system, model number, and any other specifics related to the problem. Also please exercise your best judgment when posting in the forums--revealing personal information such as your e-mail address, telephone number, and address is not recommended.

You are reporting the following post: Which executable file will run first??
This post has been flagged and will be reviewed by our staff. Thank you for helping us maintain CNET's great community.
Sorry, there was a problem flagging this post. Please try again now or at a later time.
If you believe this post is offensive or violates the CNET Forums' Usage policies, you can report it below (this will not automatically remove the post). Once reported, our moderators will be notified and the post will be reviewed.
Collapse -
(NT) (NT) Why not experiment and find out?

In reply to: Which executable file will run first??

Collapse -
According to the MS ref below, there's none... maybe there's

In reply to: Which executable file will run first??

Collapse -
Which Comes First

In reply to: According to the MS ref below, there's none... maybe there's

Since I haven't seen anything recently, I had to di out my old MS-DOS manual for this one. According to Running MS-DOS, the .com will go first, then the .exe, and last the .bat file. I would assume that order probably still stands.

Collapse -
after experiment

In reply to: Which Comes First

yea i did experiment n found the same. .com first .exe second n .bat third. but y Microsoft has set this priority.... wat was the logic behind this order. does any1 know???

Collapse -
It goes back to DOS 1.x...

In reply to: after experiment

which had a different priority (.bat, .com, .exe) that changed with DOS 2.x (.COM, .EXE, .BAT) and with the advent of NT it further changed to calling process preference (although .exe will be the normal initial default)

Reasoning deals with how DOS was constructed with intrinsic and external commands. A .com being an internal command and an executable being a external command -- was hard coded this way. The batch file (.bat) is a user file and has lowest priority.

The following link might be helpful:

Now also to be considered with WinNT, Win2K and WinXP NTVDMs one can just alter the CMD.EXE environmental variable:


and change the order to anything desired (again with the provision that the calling process can override that order)...

This link will explain the PATHEXT for you:

And this goes into even more detail:

Those links should prove helpful for background and logic should this be a bit of "homework" as this type of question normally signifies.

Collapse -
Command order

In reply to: It goes back to DOS 1.x...

That was a great response and history lesson, thank you so much. I did not recall that DOS 1.x had a different order. I guess through the years I had completely forgotten that little nugget of knowledge. Again, thanks!!!

Popular Forums

Computer Newbies 10,686 discussions
Computer Help 54,365 discussions
Laptops 21,181 discussions
Networking & Wireless 16,313 discussions
Phones 17,137 discussions
Security 31,287 discussions
TVs & Home Theaters 22,101 discussions
Windows 7 8,164 discussions
Windows 10 2,657 discussions


This one tip will help you sleep better tonight

A few seconds are all you need to get a better night's rest.