delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
DomainKey-Signature: | a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:from:to:subject:date:reply-to:message-id | |
:references:in-reply-to:mime-version:content-type | |
:content-transfer-encoding; q=dns; s=default; b=tBocndWu06eqhKlR | |
fZrjM0L1EusiNM7PJDTzaP1yVhcEei7MKNlJGwzk2leblvMq+ZT6q1I0i34r/4Nf | |
Qcu65BwjGUbOF7mKF9nRaWfvgt3mid2AR/2GQKRZgYzCGkm5McIa5cuybl5yg17n | |
LKai8DOLAOcgWgc9GXxbm/0AB2k= | |
DKIM-Signature: | v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id |
:list-unsubscribe:list-subscribe:list-archive:list-post | |
:list-help:sender:from:to:subject:date:reply-to:message-id | |
:references:in-reply-to:mime-version:content-type | |
:content-transfer-encoding; s=default; bh=EclBuuEs36XFMu+P5mtmii | |
B9gcM=; b=dctBupAdRVJLqGuKCO0KpcXES66gnCLOoMx64IIAkxpau0ceVZz9l4 | |
Tw+hq3PYaJBzJ9OH7tQizVy/McEwGdCtZVyCEbeMrL8it8o7vEe/MQLjrL1xbKFl | |
R91UUF2Z+s8rk0qpMILhF+fHlEa613nJ/WoBu1vBQZdhFi7KHtTw4= | |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.com> |
List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
List-Archive: | <http://sourceware.org/ml/cygwin/> |
List-Post: | <mailto:cygwin AT cygwin DOT com> |
List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
Sender: | cygwin-owner AT cygwin DOT com |
Mail-Followup-To: | cygwin AT cygwin DOT com |
Delivered-To: | mailing list cygwin AT cygwin DOT com |
Authentication-Results: | sourceware.org; auth=none |
X-Virus-Found: | No |
X-Spam-SWARE-Status: | No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=Hx-languages-length:909, H*MI:sk:57C1788 |
X-HELO: | homiemail-a27.g.dreamhost.com |
From: | Bengt Larsson <lists DOT cygwin4 AT bengtl DOT net> |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Proposal for new cygwin.bat which is independent from install directory |
Date: | Sat, 27 Aug 2016 15:23:41 +0200 |
Reply-To: | cygwin AT cygwin DOT com |
Message-ID: | <tc43sbdfhds56frslr3uaouodig22dorhl@4ax.com> |
References: | <57C06CFA DOT 4060405 AT t-online DOT de> <1974732522 DOT 20160826193931 AT yandex DOT ru> <daq2sb15dt33v54ekoc1p8f4snvepa0og0 AT 4ax DOT com> <57C1788B DOT 2010705 AT t-online DOT de> |
In-Reply-To: | <57C1788B.2010705@t-online.de> |
User-Agent: | ForteAgent/7.20.32.1218 |
MIME-Version: | 1.0 |
X-IsSubscribed: | yes |
Christian Franke wrote: >Bengt Larsson wrote: >> ----- >> @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). You're right although "%~dp0\subdir" still works (tested on Win10). An easier way to test exit status is cd somedir || exit /b 1 With info for those who may not know the syntax: ----- @echo off rem %~dp0 is directory of this batch file cd /d "%~dp0\bin" || exit /b 1 .\bash --login -i ----- -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |