This is the mail archive of the cygwin mailing list for the Cygwin project.

Index Nav: Message Nav: [Date Index] [Subject Index] [Author Index] [Thread Index] [Date Prev] [Date Next] [Thread Prev] [Thread Next] [Raw text]

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

```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

-----
```
Why so complicated?
```Also don't see why so complicated. While staying in the console, how
-----
@echo off

cd /d "%~dp0\bin"

-----
```
```
```
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:

```
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

```

Index Nav: Message Nav: [Date Index] [Subject Index] [Author Index] [Thread Index] [Date Prev] [Date Next] [Thread Prev] [Thread Next]