PATHEXT is fundamental to Windows and Should be recognised by CYGWIN

Doug Henderson
Thu Aug 4 07:58:00 GMT 2016

On 3 August 2016 at 22:30, Michel LaBarre  wrote:

> ...
> PATHEXT has been part of Windows for as long as I can remember - back to
> the mid-80's - used by shells that run under windows

First, this discussion is more appropriate for cygwin-talk than this list.

Second, PATHEXT is an attempt to carry the concept of default behavior
(based on its extension) for a file in the graphics window world, into the
command line world. That default behavior is hidden away in the registry
where normal users fear to tread and experts tread with care. That default
behavior is subject to the whims of the most recently installed program
than thinks it knows what the user wants to do with a file with a
particular extension.

The default behavior of a newly installed version of windows is to hide the
extension, and only show an icon in the explorer, where (again) the icon
depends on the most recently installed program than thought it knew what
icon should go with that file extension. And that icon to extension mapping
does not guarantee or require a unique icon for each extension, so, unless
you dig through the registry you have no way of knowing, in advance, what
will happen when you double click that file. And any knowledge you gained
from experience may get changed by the next program you install, without
your knowledge or permission.

A couple of examples: I work with Oracle databases, so 90% of my .sql files
are Oracle scripts and PL/SQL. I had to install MSSQL for some reason, and
suddenly an accidental double click on an .sql file was opening some huge
slow Microsoft tool instead of SQL Developer. It was an annoying fiddle to
restore useful behavior.

I use Python a lot. I have 7 versions (of Python, 5 for Win, 2 for cygwin,
plus Jython and IronPython) installed right now, so I need to pick my
environment for each .py file, or for my current project. I had to install
Visual Studio and a Python plugin for it. VS hijacked my .py files, ignores
#! lines, and takes forever to load and open an editor window. Now though,
double clicked a .py file or entering its name (with or without the
extension) at the command prompt opens it in a fast and useful text editor.

To summarize, I don't think PATHEXT is such a great feature of the command
prompt that it needs to be emulated in cygwin.

If I have gone to the trouble of typing "./name_of_file", (you don't have
"." in your PATH do you?) it's no big effort to hit TAB (for command
completion) and fill in the explicit extension. And if I'm writing a
script, I'm a fool if I don't include the extension.

And BTW, I set CYGWIN_NOWINPATH=1 from the control panel so I can't
accidentally run a windows program when I meant to run a cygwin one.


Doug Henderson, Calgary, Alberta, Canada

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list