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).


Christian


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Reply via email to