X-Recipient: archive-cygwin@delorie.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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=D9
	QAiqBas/GRx7Vijx2CF6bbmS2SAqT2U3rOLHScMPCBYfljb0L7wWojaKhpccQG07
	UJtBXFytbh3rv4hEd+ZgYgH4m1CviK9NHGhBuEnzQMVMsPZx1P737VIOJIvEZtlm
	DIyTLWifhRJT/sA+N7ZW9MN0hsu/FFs5ZQ3pJTDgc=
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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=Zjh51wxE
	0qWGrvFftraNV8oozfk=; b=Gexm/q3iuQE6OLoW2f4l1jt467jILYUDuyenQ1U5
	zQ70opfWnFfA6MiJLx51OtNcTkbHA04GYadGkja4VqBOIEsqv+tL83HkeQWQNd7V
	Co7eWOuwjI6bwGXwe/OAcpG/yu6M1GPR5DfOM1kj0GUVpNzivEFhKrRSbu83OUbM
	Dw0=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
X-Spam-SWARE-Status: No, score=-3.0 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.2
MIME-Version: 1.0
X-Received: by 10.180.13.83 with SMTP id f19mr5817765wic.54.1376295490584; Mon, 12 Aug 2013 01:18:10 -0700 (PDT)
In-Reply-To: <DUB123-W29CB87179CAE6145C437BBB1580@phx.gbl>
References: <DUB123-W29CB87179CAE6145C437BBB1580@phx.gbl>
Date: Mon, 12 Aug 2013 10:18:10 +0200
Message-ID: <CAEhDDbBvppt2o5g1rpyCpxva7sga-bhkEPctoa8nau=pX0Btqw@mail.gmail.com>
Subject: Re: Source a .bat file from bash
From: Csaba Raduly <rcsaba@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=ISO-8859-1

Hi Saurabh,

On Fri, Aug 9, 2013 at 10:42 PM, Saurabh T wrote:
> Is there a way to source a .bat file from bash and have the paths and other environment variables set in it apply in cygwin?
>

Note that "to source" in UNIX shell parlance means "read the file and
interpret it". Bash can't do that with a .bat file (it's in a
different language).

You could run cmd.exe to interpret the .bat file, but changes to th
environment get lost when cmd.exe exits. One possibility is to run
bash from the cmd.exe window after the batch has finished.

some_command could be:

cp $1 /tmp/bat-to-bash-$1
echo 'c:\cygwin\bin\bash.exe --login' >> /tmp/bat-to-bash-$1
cmd.exe /tmp/bat-to-bash-$1

(this might work, but I haven't tested it)

Csaba
-- 
GCS a+ e++ d- C++ ULS$ L+$ !E- W++ P+++$ w++$ tv+ b++ DI D++ 5++
The Tao of math: The numbers you can count are not the real numbers.
Life is complex, with real and imaginary parts.
"Ok, it boots. Which means it must be bug-free and perfect. " -- Linus Torvalds
"People disagree with me. I just ignore them." -- Linus Torvalds

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

