On Windows, what filename extensions denote an executable?
The basic "executable" files (the ones Windows looks to execute via the PATH) are stored in an environmental variable called PATHEXT. You can see this from a command prompt:
C:\>set PATHEXT
On my machine, I get this (WinXP):
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.PSC1
This is not an exclusive list. Windows will also execute other files (for instance, screen savers have an extension of .scr and are executables); Windows will also allow execution of other file extensions, but the ones listed above are the default executable extensions.
On Windows, what filename extensions denote an executable?
Denote to what?
I know that question probably sounds a bit confusing at the moment, but the question matters. As I explain why it matters, the question will become more clear.
Although Ken White's answer of the PATHEXT variable (in the command prompt's "environment") is a nice and short answer, and that answer may work well for you, the answer is incomplete. The reason that is incomplete is that the correct answer is different based on what you are trying to do.
For example, you might try to:
- Run a program from a "traditional command prompt" ("CMD"), by typing its full filename
- Run a program from a "traditional command prompt" ("CMD"), by typing the base filename, but leaving off its extension
- Use the "start" command that is built into the "traditional command prompt" ("CMD")
- Run a program from PowerShell
- Run a program from the "Run" menu item, found on the start menu
- Run a program from Explorer, by trying to double-click an icon related to a file ending with the extension
- Tell Microsoft Internet Explorer to open a downloaded file
- Run a program using a function from the Microsoft Windows API. (This is something that end users don't typically do, but computer programmers may do this, and so the information is relevant to them.)
Some of these methods of running programs may use different methods of determining what filename extensions may be supported. In particular, using CMD may be different than the Run menu.
For instance, Wes's puzzling blog: Customizing Windows Run Command... notes different locations being checked, including the registry key.
The answer may also depend on what version of Microsoft Windows is being used. In Windows 10, I just typed the name of a zip file at a command prompt, and it opened up Windows Explorer. I seem to remember that not working in Windows XP (although in Windows XP, I could type "start filename.zip" and get the same sort of effect). So either my memory is faulty, or Microsoft has been trying to make improvements in newer versions of Windows. (Hopefully, for me, the latter.)
In Windows 10's traditional command prompt (running "CMD"), when I go to the location (using the "CD" command) of a zip file, and type "filename.zip", then the file will open. When I go to that location, and type "filename" (leaving off the ".zip" file extension), then Windows does not find the file. However if I run "ECHO %PATHEXT%
" and then "SET PATHEXT=%PATHEXT%;.ZIP
" (and then "ECHO %PATHEXT%
" again, to make sure I had the desired effect), then I can type "filename" and the command prompt will find the .ZIP file. So, that is the effect of the %PATHEXT% variable.
You may be able to see another list of extensions by running the ASSOC
command. For example, running that command shows multiple lines of output including the following (on my system) - ".zip=CompressedFolder
". Then, I can see what that runs by typing "FTYPE | FIND /I "CompressedFolder"
". (That is meant for the traditional command line. PowerShell won't like those unescaped quotation marks.) (If you just type "FTYPE
" without the rest of that command line, you'll see quite a bit more output about other extensions.)
If I type "ASSOC | FIND /C "."
", on my Windows 10 computer, then I find that I have 339 lines of output when I check for file associations that way.
MS KB 162059 is all about adjusting how Internet Explorer opens Office documents.
So, asking for the list of default executables is too vague. Different components of Microsoft Windows may use different resources, so the question needs to be more specific for a precise answer.
The question did mention using Explorer to double-click on an icon. To see the list of executables used by that, I believe you'll be wanting to check out the registry. You can run this from a command prompt:
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts
(I'm not going to list them here. There are 286 of them on my Windows 10 computer.)
That lists the extensions. To see more information, including details about the extensions:
reg query HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts /s
So, as you can see by now, this seemingly innocent question can actually be a quite complex topic. I believe I've made my case on why a question should be quite specific in order to be able to get a complete answer that totally addresses how a single component of Windows may determine the filename extensions. In a nut shell, there isn't just one single answer for Windows, since Windows has multiple components that behave in different ways. Hopefully I've begun to show that, and pointed to some additional resources that show relevant information.
A common one for installer programs is .msi
.