Geo Choi
Geo Choi

Reputation: 13

Is ".exe" the only extension of executable program in Windows OS?

I found every process running on my computer has .exe extension on task manager.

Someone said that batch file (.bat) and bytecode (maybe .class) are also executable program, but I think they are just a file running by other executable program (.bat - cmd.exe, .class - JVM, .cpl - rundll32.exe) according to what I saw on task manager

task manager picture

Is ".exe" the only extension of executable programs in Windows OS?

Upvotes: 0

Views: 1908

Answers (1)

phuclv
phuclv

Reputation: 41753

If you're talking about executing commands then all the extensions in the %PATHEXT% environment variable can be run without specifying the extension. For example *.bat, *.vbs... are all "executable" in that sense

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

If it's about binary executables then Windows doesn't care about the extension of executable files. It just checks the format and if it's a supported binary format then it'll be run. Modern Windows uses PE format which starts with the MZ magic number so if you create a *.TXT file with MZ at the beginning and run it in cmd then it'll actually be treated as an executable file. In fact many files in the System32 folder like *.SCR, *.CPL... are also PE files and still run when we double click on them. And even *.COM files in modern Windows apps are also PE files. The *.COM extension is only for differentiating with another *.EXE of the same app, but with priority in running because *.COM is put before *.EXE in %PATHEXT% by default as can be seen above:

Windows 10 (not ) even supports running Linux ELF executables directly and they of course doesn't have any extension by default. Since the file is run inside the VM instead of directly under Windows kernel like in

Depending on Windows version it may support many more executable formats. The complete list is

And they don't depend on the extension either except for the raw *.COM file

Upvotes: 3

Related Questions