Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The whole .COM/.EXE thing is not limited to 16-bit DOS and Windows. For a very long time now, Windows simply treats both extensions as the equivalent of chmod +x, but the way the binary is loaded does not depend on the specific extension. That is, if a .COM file has a 64-bit PE header, it will happily execute on Win11.

Indeed, a bunch of system binaries are themselves like that for historical reasons - CHCP.COM, FORMAT.COM, MORE.COM etc - because they originally had such names long ago in DOS, and someone somewhere might have a batch file that includes the extension.



Btw, you can even run a executable file which has been renamed to any extension (.txt or .whatever) in command line. (See PATHEXT env) It just recognized by the explorer (and shellexecute api’ third parameter). So that’s mean all files have “executable” permission by default.


> they originally had such names long ago in DOS

And DOS got them from CP/M before it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: