PATHEXT is fundamental to Windows and Should be recognised by CYGWIN

cyg Simple
Tue Aug 9 16:46:00 GMT 2016

On 8/9/2016 10:13 AM, Erik Soderquist wrote:
> On Tue, Aug 9, 2016 at 8:58 AM, cyg Simple wrote:
>> I tried "chmod +x foo.txt; ./foo.txt" but that results in Cygwin
>> assuming the text file is a script and executing each line of the file.
>> If PATHEXT were used only to determine that the file should be passed to
>> ShellExecute instead it might be beneficial but since I can easily just
>> do "cmd /c foo.txt" then probably not so much.
> That is the behavior I would expect in any *nix environment, and
> therefore consider the correct behavior within cygwin.

But any text file, regardless of the mode, regardless of #! first line
will be executed at least by bash; I have tested the other shells.  This
isn't expected behavior as I see it.

$ uname -a
CYGWIN_NT-10.0 HAL2002 2.5.2(0.297/5/3) 2016-06-23 14:29 x86_64 Cygwin

$ bash --version
GNU bash, version 4.3.42(4)-release (x86_64-unknown-cygwin)

> Additionally, starting a text editor for foo.txt is not a function of
> PATHEXT, but rather of file association.  In CMD.EXE,
> C:\tmp>echo some text >foo.txt
> C:\tmp>foo
> 'foo' is not recognized as an internal or external command,
> operable program or batch file.
> C:\tmp>echo echo some text >foo.cmd
> C:\tmp>foo
> C:\tmp>echo some text
> some text
> C:\tmp>
> PATHEXT looks for *executable* files, not file association.  I warned
> previously in this thread about getting the two confused.

Thanks for stating this emphasis again.  I overlooked it the first time.
 I'm satisfied that PATHEXT shouldn't be used to determine an executable
file.  I'm not satisfied that we should continue with the .exe
artificial symlink for the same reasons we shouldn't use PATHEXT.
Because of the amount of time to port scripts and software to use the
.exe suffix for executable files it should be an optional configuration
that is on by default with a scheduled deadline (two or three years) to
make it off by default.

cyg Simple

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list