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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=M1YfdmGYUdKjfF+8 DRk92KnP1dzMeAeV8rqlagNgt/yBaokvf5vOXe9yPVIivXiu+TTInUyu8RY+CU7C h8o/UOWE6miozAtXprFShLBAo9QRI6F+YCdlGfPaj2A7Jx/T3NT3HHzPBq766+bD RJn+7KPSIuajCu7PpYh8C6AgO9I= 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:subject:to:references:from:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=pPI4xXj19xSMaPBBV7XGxh 9ge0A=; b=rT01pRQQa5HOTVhzLzWNchFXD1uQVimDZVHHuU/HurRoRw802iGX+g XbfnIUYBOWN8ByN96ygRNnYo5KvhSoH1SlAIEQceuVmzLiuVocDUtoe4vg61EnL2 1fbWT9td6M/lQ/ZpLgnLO9osgkuGbzu6nguVqFn4X5DQqKkvZ2ml0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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.6 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD autolearn=no version=3.3.2 spammy=HX-Envelope-From:sk:Christi, larsson, bengt, Larsson X-HELO: mailout12.t-online.de Subject: Re: Proposal for new cygwin.bat which is independent from install directory To: cygwin AT cygwin DOT com References: <57C06CFA DOT 4060405 AT t-online DOT de> <1974732522 DOT 20160826193931 AT yandex DOT ru> From: Christian Franke Message-ID: <57C1788B.2010705@t-online.de> Date: Sat, 27 Aug 2016 13:24:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0 SeaMonkey/2.40 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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