4 ms·
IIRC, when the DOS/Windows shell needs to resolve "program" to either "program.com" or "program.exe", the .com file takes precedence - ISTR this being abused by
by ajdlinux 9y ago
IIRC, when the DOS/Windows shell needs to resolve "program" to either "program.com" or "program.exe", the .com file takes precedence - ISTR this being abused by malware once upon a time.
- colejohnson66 9y agoI'm guessing it's because `example.com` comes before `example.exe` when you sort alphabetically? So when it goes looking for `example`, it gets the list of files and takes the first matching one it sees.
- vram22 9y agoOr maybe because .COM format was invented before .EXE format (since .COM is simpler)? Just guessing.
- colejohnson66 9y agoMaybe someone could disassemble DOS to find out why? Sounds like a project for me this weekend
- lucb1e 9y agoIirc, MS-DOS is open source and in some museum now.
- maxlybbert 9y agoDOS 1.1 is available online from the Computer History Museum ( http://www.computerhistory.org/press/ms-source-code.html http://www.computerhistory.org/press/ms-source-code.html ). But I think that may be too early to be useful.
- int_19h 9y agoThey also offer DOS 2.0. But DOS had EXE, COM and BAT files since version 1.0.
- maxlybbert 9y agoThank you.
- int_19h 9y agoSee my reply in another branch. https://news.ycombinator.com/item?id=14433246 https://news.ycombinator.com/item?id=14433246
- int_19h 9y agoIt's not alphabetic, because the full order is COM, EXE, BAT - and if it were alphabetic, it would have been BAT, EXE, COM.