Proposal for new cygwin.bat which is independent from install directory

Thomas Wolff
Sat Aug 27 16:20:00 GMT 2016

Am 27.08.2016 um 13:24 schrieb Christian Franke:
> Bengt Larsson wrote:
>> Andrey Repin wrote:
>>>> The following should work since WinXP regardless of install directory:
>>>> -----
>>>> @echo off
>>>> cd /d %~dp0
>>>> if errorlevel 1 exit /b 1
>>>> cd bin
>>>> if errorlevel 1 exit /b 1
>>>> bash --login -i
>>>> -----
>>> Why so complicated? 
>> Also don't see why so complicated. While staying in the console, how
>> about:
>> -----
>> @echo off
>> cd /d "%~dp0\bin"
>> bash --login -i
>> -----
> An errorlevel check is IMO mandatory after a cd command. Otherwise 
> another bash in the PATH might be started if the directory does not 
> exist.
> Hmm... therefore it is also better to change the last line to:
>   .\bash --login -i
> The directory change is intentionally done with two cd commands to 
> avoid possible problems with cmd variants (on Win10 "%~dp0" expands to 
> a path with trailing backslash).
If someone submits a patch to change cygwin.bat, please also add a 
command to clear $TERM on that occasion, in order to avoid trouble if 
cygwin.bat is started from a terminal:
set TERM=


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list