Why does WinSCP use a .com binary for the CLI version and an .exe binary for the GUI?
I thought .com is an ancient form for executable, leftover from early MS-DOS days? Why do they use that today in WinSCP? And why only for the CLI version?
I tried asking this in their chat room, but received not a single reply for days. As always.
Solution 1:
Both WinSCP files are actually regular Win32 executables in the standard Windows PE format.
(Windows does not actually require the format to match the extension – as long as the shell detects that it is a known "executable" extension, it'll simply tell the OS to execute it, and the OS kernel itself will take care of format specifics.)
However, when Windows Cmd.exe searches %PATH% for a matching executable, it does so in the order specified by the %PATHEXT% environment variable – which lists .COM
before .EXE
.
So if you simply type winscp
in Cmd, then the command shell will prefer to run winscp.com
(which is the CLI tool) instead of winscp.exe
(which is graphical).