PATHEXT is fundamental to Windows and Should be recognised by CYGWIN

Andrey Repin
Thu Aug 4 21:02:00 GMT 2016

Greetings, Bill Smith!

> A couple of years ago I was involved with porting a very large code base of
> makefiles & shell scripts to work with Cygwin.  In our environment, the main
> issue was shell scripts calling *.bat files without the .bat suffix because
> of the $PATHEXT.

Sounds like it wasn't a *NIX code base.

> The fix was to change

> somescript

> To
> somescript${BAT}

> where ${BAT} would be set to .bat on Windows.

In this case, just changing the calls to use real names would've sufficed.

> Another option available was to create wrapper shell script.  So I would create a script named "somescript"
> that is only in $PATH on Windows and it would look something like this:

> #!/bin/sh
> adaptman.bat "$@"

> Granted our *.bat files are simple and don't have to worry about arguments with spaces.

No, this is a very messy way to do it. Highly prone to backfires.

Correct way would've been (assuming this code base of yours is not purely
Windows, like I thought) is to use same shell scripts it would call otherwise,
instead of bat files, and enhance them to find relevant bits of information if
run under Cygwin, where applicable.
Then discard the .bat files and breathe free at last.

With best regards,
Andrey Repin
Thursday, August 4, 2016 17:36:13

Sorry for my terrible english...

Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list