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.

If under my Windows with CygWin (v2.831 32bits) I do:

cmd
mode 80,50

the screen width changes, but if I open a CygWin terminal, like bash:

C:\cygwin\bin\bash --login -i
$ mode 80,50
bash: mode: command not found

So I assume the "mode" command does not exist anymore. As long as many other commands keep existing, like:

$ getmac
Dirección física    Nombre de transporte
=================== ==========================================================
08-00-27-37-19-63   \Device\Tcpip_{8B079C63-6C1A-4D39-AF22-6F692B0188EB}

(My Windows is in spanish, sorry)
I was wondering what other commands (or maybe devices, but not like NUL, that concretely keeps existing) do disappear?

EDIT: For googlers arriving here in search of the "more" issue, it is included in the package util-linux of CygWin.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
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 Mar 2 at 22:08
    
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 Mar 5 at 11:40
    
@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 Mar 5 at 17:03
    
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 second TAB pressing. –  Sopalajo de Arrierez Apr 12 at 20:22

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.