4

For example if there are multiple executable files on the path i.e., a.exe, a.bat and user types 'a' (enter), which file will execute?

What other executable formats are supported on Windows?

Asad Iqbal
  • 3,241
  • 4
  • 32
  • 52
  • Thanks for your responses, but these are three different answers - which all look right. Could you all converge on one? – Asad Iqbal Oct 20 '11 at 16:41
  • As for the first question ("what are the executable types") and the last question ("What other executable formats"), those outer questions (though not the middle question about priorities) are basically duplicated at the older [SuperUser: On Windows, what filename extensions denote an executable?](http://superuser.com/questions/228680/on-windows-what-filename-extensions-denote-an-executable/1182994#1182994). – TOOGAM Feb 26 '17 at 16:51

2 Answers2

7

Windows looks at the PATHEXT environment variable to decide which file types are considered executable:

> echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

The first matching file on the path that has one of those extensions will be executed.

You can use the assoc and ftype commands to find out how the file will be executed:

> assoc .msc
.msc=MSCFile

> ftype MSCFile
MSCFile=%SystemRoot%\system32\mmc.exe "%1" %*

(You can use PATHEXT, assoc and ftype to make any file type executable.)

RichieHindle
  • 272,464
  • 47
  • 358
  • 399
1

Precedence is: DOSKEY Macro .COM .EXE .BAT

http://support.microsoft.com/kb/35284

Martin Beckett
  • 94,801
  • 28
  • 188
  • 263