Nope, the 'mode' command does not "disappear", and you can still invoke it as 'mode.com'.
What happens is that the Cygwin version of bash is appending ".exe" to an possibly executable name in the prompt when it loops searching for files in the PATH directories.
However, the classical Windows cmd.exe appends both ".exe" and ".com" (".bat" and ".cmd" too) in that same process.
C:\Windows\System32>where mode
C:\Windows\System32\mode.com
To answer the second question, I've looked up the cygwin path to mode.com of Windows:
$ which mode.com
/cygdrive/c/Windows/system32/mode.com
and obtained a list of *.com executables in the same directory.
$ ls -l /cygdrive/c/Windows/system32/*.com
By watching the results, we can say at least the following commands "disappear" in bash: chcp.com, diskcomp.com, diskcopy.com, format.com, mode.com, more.com, tree.com.
UPDATE 2014-03-05 16:45 GMT+0100: Whereas CMD.EXE autocompletes all files in PATH with an extension from PATHEXT list, bash autocompletes all files in PATH, which are executable, regardless of their extension.
If I type 'forma' and press TAB, it is correctly autocompleted to 'format.com'. However, if I type 'mode' and press TAB once, only a beep is produced; if I press TAB once more, a choice between 'mode.com' and 'modemui.dll' is presented. After a bit more testing, I think there is a bug with Cygwin bash completion, which results in a beep being produced on first TAB press instead of a choice being printed. This is independent of extension.
Another issue is that I can type either 'notepad' or 'notepad.exe' and cygwin figures out that it has to execute /cygdrive/c/Windows/system32/notepad.exe. At the same time, if I want to execute 'foobar.bat' or 'foobar.com', I need to provide an extension. It appears that Cygwin has special handling of '.exe' suffix, which is indeed the case (see perhaps_suffix function and stat_suffixes array). Furthermore, it looks like '.bat', '.com', and '.cmd' were removed on purpose in spawn.cc version 1.214 and were not added back in a more recent update.
Feel free to ask about the first issue in cygwin mailing list, and about the second one in cygwin-developers. I'm not really involved in Cygwin myself, but that's how you can contribute to it! :-) Also, to correct my answer for your initial question: all windows executables with extensions from PATHEXT list except .EXE do disappear:
C:\Windows\System32>echo %PATHEXT%
.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
Thats correct, @mkalkov. I have edited your answer to add «".bat" and ".cmd"» to the list of executable programs that the cmd.exe shell searchs for. Thanks you. – Sopalajo de Arrierez – 2014-03-02T22:08:28.953
This process is refered to as "Path Extension". There could probably be some way to include .com files or any others, like .lnk. Meanwhile, just typing "mode.com" is enough for me (easier with the classic tab completion, of course). – Sopalajo de Arrierez – 2014-03-05T11:40:58.847
@SopalajodeArrierez, thanks for your replies. I've looked closer at this issue and figured out the root cause of your problem as well as found a better answer. – mkalkov – 2014-03-05T17:03:24.060
first
TAB
pressing produces a beep if there is more than one option in every Linux shell I know of. That is completely normal. I don't think that should be a bug. Choices are only printed on screen after secondTAB
pressing. – Sopalajo de Arrierez – 2014-04-12T20:22:44.837