Executable File Extensions on Windows

file extensionfilenameswindows

On Windows, *.exe, *.bat, *.cmd, and *.com all represent programs or shell scripts that can be run, simply by double-clicking them. Are there any other filename extensions that indicate a file is executable?

EDIT: When I jump into a new project (or back into an old project!), one of the common things I want to do when looking around is to find out what tools there are. On Unix (which I've used for decades), there's an execute bit, so this is as simple as:

find . -executable -type f

I figured that on Windows, which seems to have a much more complex mechanism for "is this executable (and how do I execute it)", there would be a relatively small number of file name extensions which would serve roughly the same purpose.

For my current project, *.exe *.bat *.cmd is almost certainly sufficient, but I figured I'd ask if there was an authoritative list.

Best Answer

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.

Related Question