Reputation: 13
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
Is ".exe" the only extension of executable programs in Windows OS?
Upvotes: 0
Views: 1908
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 wsl (not wsl-2) even supports running Linux ELF executables directly and they of course doesn't have any extension by default. Since wsl-2 the file is run inside the VM instead of directly under Windows kernel like in wsl
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