Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!mit-eddie!ll-xn!ames!necntc!gkb From: gkb@necntc.NEC.COM (Greg Busby) Newsgroups: comp.sys.ibm.pc Subject: Re: Nestled Batch Files Under MS-DOS Message-ID: <9333@necntc.NEC.COM> Date: Fri, 18-Sep-87 11:00:42 EDT Article-I.D.: necntc.9333 Posted: Fri Sep 18 11:00:42 1987 Date-Received: Sun, 20-Sep-87 01:59:35 EDT References: <874@cg-atla.UUCP> Reply-To: gkb@necntc.UUCP (Greg Busby) Organization: NEC Electronics Inc. Natick, MA 01760 Lines: 34 In article <874@cg-atla.UUCP> harty@cg-atla.UUCP (Kevin Harty) writes: > > I wish to execute a batch file from within in a for >loop of another batch file. > f00.bat > for %%1 %%2 %%3 in (*.plt) do ( f001.bat) > The problem is that f001.bat is executed once and does >not return to f00.bat. I have heard a rumor about a work >around in "config.sys" or something but could not find any >documentation. > Could someone either mail to me at decvax!cg-atla!harty >or post a solution if there is one ? > kjh The solution is very simple, given in the April '87 _Computer Language_. Simply precede the call to the second batch file by 'command /c' and you force DOS to load another copy of the command interpreter which is being run by the first copy. When this copy exits, it returns to the first copy and hence to your original batch program. I have used this successfully a number of times, although I have never nested more than one level (although I would assume that it would work for more). In your example, for %%1 %%2 %%3 in (*.plt) do command /c foo1 Good luck. GKB