delorie.com/archives/browse.cgi | search |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <44E5513C.E7EA2275@dessent.net> |
Date: | Thu, 17 Aug 2006 22:33:48 -0700 |
From: | Brian Dessent <brian AT dessent DOT net> |
X-Mailer: | Mozilla 4.79 [en] (Windows NT 5.0; U) |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Re: Newbie: Setting environment variables from a .bat file |
References: | <ec3ejc$kqv$1 AT sea DOT gmane DOT org> |
X-IsSubscribed: | yes |
Reply-To: | cygwin AT cygwin DOT com |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
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 |
Neil Kolban wrote: > I have some windows BAT files that set some windows CMD environment > variables. I am hoping to run a shell under cygwin but when I run the BAT > files from a shell prompt, the BAT file set variables are not exported to > the parent shell. Is there a way that I can have BAT file set variables > visible in the calling environment? As cgf said it doesn't work that way, a child cannot affect the environment of its parent. But you can work around this in several ways. You can execute the .bat file first to set up the environment and then launch bash from that same session, and it will inherit the settings since bash will be a child process. Or you can translate the .bat file into bourne shell syntax (using e.g. sed/awk if necessary for automation) and 'source' it from within bash, which will set the current environment since no child is created when you source a file. Brian -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |