tcsh doesn't find commands that end with .exe

Volker Quetschke
Tue Jun 14 01:22:00 GMT 2005

>>>>I have the following problem with tcsh:
>>>>tcsh doesn't find the program if the .exe extension is given.  whoami is
>>>>only an example, this also happens to other programs.
>>>>[quetschke@Macros ~]$ which whoami
>>>>[quetschke@Macros ~]$ which whoami.exe
>>>>whoami.exe: Command not found.
>>>That's by design.
>>You mean the grand design that leads earth and all its inhabitants
>>to eternal bliss?
>>And if so, it seems to have a flaw:
>>[quetschke@Macros ~]$ which cmd.exe
>>[quetschke@Macros ~]$ which cmd
>>Care to elaborate where the difference comes from?
>>Why should I not be allowed to start a program with it's
>>real name? And why does it work sometimes?
> Dunno why it prints cmd.exe but by design (minus flaws) tcsh only
> starts applications given w/o path if the application is in the
> internal hash table.  The internal hash table stores the application
> names w/o .exe suffix.
And all lower case, (cygwin only). Try something like this:

Put progA.exe in /mytestexedir and add that to your PATH.

Start a tcsh and type "prog<TAB>"
[quetschke@Macros ~]$ prog
progA    progman

Aha progA, good try this.

[quetschke@Macros ~]$ progA
progA: Command not found.

Hmmm, try proga:

[quetschke@Macros ~]$ proga
(here will be the output of progA.exe)

Well, better don't use mixed cases.

> If you need something different:
The maintainer might think about removing "strlwr(dp->d_name);"
from line 776 of sh.exec.c .

Oh and somehow tcsh's hash cannot handle directories with very many
files (i.e. /cygdrive/c/WINDOWS/system32/) therefore it doesn't seem
to hash them and does a real lookup instead. (I didn't look hard enough
at the code to really proove this, but just copy everything from
  /cygdrive/c/WINDOWS/system32/ into /mytestexedir/ and you will see
that proga progA.exe proga.exe can now be found and accessed. Just like
cmd CMD cmd.exe CMD.EXE .... )


$ ll /mytestexedir/ | wc -l

PGP/GPG key  (ID: 0x9F8A785D)  available  from
key-fingerprint 550D F17E B082 A3E9 F913  9E53 3D35 C9BA 9F8A 785D
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 254 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Cygwin mailing list