Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

3 Answers

up vote 15 down vote accepted

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
share|improve this answer
1  
Brilliant find! –  barlop Jan 3 '11 at 20:27
1  
additionally, you can add more - for example, add .py to let "pyscript" run "pyscript.py"! –  Phoshi Jan 3 '11 at 22:45
    
@Phoshi but with .py then you're going third party, and there's no end –  barlop Jan 4 '11 at 7:57
    
@barlop; Indeed I am, but it's a useful thing to know, if tangential to the question :) –  Phoshi Jan 4 '11 at 9:04
1  
Theres also .SCR for screensavers. They can (and do) contain actual execution code for the screensavers. They're just not in PATHEXT. –  sinni800 May 3 '13 at 10:27
show 2 more comments

.vbs is a script. and .js

But if you know some history then you'd be able to put things in context better. I suppose if I hadn't used computers for as long as I have, I might also focus on knowing which extensions are executables..'cos they're quite exciting and seem fundamental.. and I suppose they are.. But notice how with time, .COM died out a lot after DOS, just mainly known I suppose after that if at all, in windows 9x in command.com shell. Maybe old NTs used them a lot. Scripts.. vbs came around win9x time perhaps.. so new ones appear. ps1 is even newer than vbs.

.COM is very old.. i'm not sure if windows xp for examples relies on any .COM files. But it has a command.com more for legacy apps I guess.

.BAT is a script..back from DOS days. still in use today. .VBS is more modern but .BAT is still used and won't go out of use any time soon, and people sensibly use both. There's .CMD which I haven't used but probably not so different to anything. There's ps1 (powershell. this is more modern than vbscript) If we're talking scripts in a loose sense, there are .REG

Really the term executable only applies to EXE and .COM(.COM being basically extinct.. more a win9x thing (the command prompt in win9x was command.com , there was no cmd.exe) , and COM files are a DOS thing. But not NT's CMD for example NT's command shell is cmd.exe though as mentioned there is a command.com in NT I guess for legacy apps but NT most probably doesn't rely on it)

.MSC e.g. start..run..services.msc They are not executables..I suppose they are a kind of script.. services.msc seems to be written in xml) But if going that loose then one might go a step further to non system things, and say HTML pages are one 'cos they are interpreted.. like a script. But not by the OS though.. .CPL are not scripts.. look at them in notepad. People tend not to think of them as executables or scripts, maybe 'cos only MS developers write them. (or if others do then that's very uncommon!)

share|improve this answer
    
Unfortunately, adding .MSC to the PATHEXT does not let you run MMC snap-ins without adding the extension (eg services instead of services.msc). :-( –  Synetech Feb 24 '12 at 6:34
    
@Synetech because there is already a services.exe. –  kinokijuf Aug 26 '13 at 16:13
    
@kinokijuf, true; if you run diskmgmt (without the extension) from a command-prompt it will work, but running services won’t. However none of them will work if you try to run them from the Run dialog without the .msc extension, even though the system-wide pathext variable contains .msc. –  Synetech Aug 26 '13 at 16:57
add comment

A common one for installer programs is .msi.

share|improve this answer
3  
It's really less an executable format and more a script format, since it still needs to be parsed by msiexec.exe. –  Hello71 Jan 3 '11 at 22:40
    
@Hello71: Are you really 12? –  paradroid Jan 4 '11 at 1:32
    
@paradroid: no, he's really not. look at his writing style. –  studiohack Jan 4 '11 at 1:39
    
@paradroid: Does it really matter? –  Hello71 Jan 4 '11 at 1:49
    
@studiohack: That is what I am confused about. @Hello71: Yes, it does, because if you are, you scare me. –  paradroid Jan 4 '11 at 2:00
show 3 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.