0

I have multiple batch files. Each batch file opens an exe file and run a command. The command compiles the results in csv format. This all works like heaven.

I am trying to create a master batch which could run each of the batch file one by one. The individual batch file names are as 1.bat, 2.bat . . . .32.bat

I tried,

Call 1.bat
Call 2.bat
.
.
.
Call 32.bat

but it is only running the first command...

I also tried without call, same result.

I am using the following code in each batch file:

Start /D "C:\test 2\" CSC.exe "1.lq"

Start /D "C:\test 2\" CSC.exe "2.lq"

and so on

Can anyone help me crack this?

All I want My master bat to run first batch, on completion run second and so on so forth.

Hope it makes sense.

I really appreciate your help on this guys.

Shei

Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Shei7141
  • 15
  • 1
  • 2
  • 7
  • 3
    can you show us the contents of some of the BAT files? it's probably something related with a secondary BAT being invoked or the current directory being changed. – PA. Sep 02 '13 at 21:29
  • possible duplicate of [Running multiple batch files from a single batch file](http://stackoverflow.com/questions/14154893/running-multiple-batch-files-from-a-single-batch-file) and [Can't run multiple batch files sequentially from master batch in Win7](http://stackoverflow.com/q/17903609/62576) – Ken White Sep 02 '13 at 21:29
  • 2
    Continuing PA's theme - Or the problem could be an EXIT in your 1.bat. You want EXIT /B, not EXIT. – dbenham Sep 02 '13 at 21:30
  • @KenWhite It's not a duplicate as he obviously implemented the accepted solution from that question, but encountered issues with it. – Ansgar Wiechers Sep 02 '13 at 21:31
  • @AnsgarWiechers: Then the poster needs to provide more information that makes it different from those questions. Without more details, they're the same question. – Ken White Sep 02 '13 at 21:37
  • You need to use `start /wait` if you want the batch files to wait for the external commands to complete: `start /d "C:\test 2" /wait csc.exe "1.lq"`. If that doesn't help, try with just 2 or 3 child scripts, and add `echo` statements with a running number at beginning and end of each child script, so you can see at which point things stop working. – Ansgar Wiechers Sep 02 '13 at 22:17

1 Answers1

0

Try like this:-

START /WAIT  batch1.bat
START /WAIT batch2.bat
Rahul Tripathi
  • 168,305
  • 31
  • 280
  • 331
  • It runs the first batch, closes the window and than leave other windows hanging and do nothing, I am afraid. – Shei7141 Sep 02 '13 at 21:32
  • 1
    @Shei7141 Then you need to show the code of (some of) the child batch files as *PA.* requested. – Ansgar Wiechers Sep 02 '13 at 21:34
  • @Shei7141 Please update your question with that code. It's likely to go unnoticed by others if you post it in a comment to an answer. – Ansgar Wiechers Sep 02 '13 at 21:41
  • @Shei7141:- I think you need to move the START /W command and put it in every batch file in front of (every) command that that batch file executes and doesn't wait for the termination of. – Rahul Tripathi Sep 02 '13 at 21:47
  • Thanks, I tried it and change the code to Start W "C:\test 2\" ccs.exe "runMe.lq". But I am getting an err now. . . . Please help – Shei7141 Sep 02 '13 at 21:54
  • I also tried Start W start /d "C:\test 2\" ccs.exe "runMe.lq". but same happened . . . – Shei7141 Sep 02 '13 at 21:55
  • How about Start /W "C:\test 2\" ccs.exe "runMe.lq"?? – Rahul Tripathi Sep 02 '13 at 21:55
  • Did you checked this:- http://stackoverflow.com/questions/17903609/cant-run-multiple-batch-files-sequentially-from-master-batch-file-in-win7 ??? – Rahul Tripathi Sep 02 '13 at 22:12
  • 1
    And http://stackoverflow.com/questions/9321977/starting-multiple-batch-files-at-the-same-time ?/ – Rahul Tripathi Sep 02 '13 at 22:12
  • And this:- http://stackoverflow.com/questions/12187938/run-batch-files-sequentially ?? – Rahul Tripathi Sep 02 '13 at 22:12
  • Thanks Rahul, I saw and tried the provided links but still same thing is happennig. If I use start, or start wait, it is runing the first bat and leaves the other windows opened. If I use call it is just calling first bat and that is it..... – Shei7141 Sep 02 '13 at 22:19
  • @Shei7141 Please don't shout. We're not deaf. And please refrain from flooding an answer with comments. This is not a chat. – Ansgar Wiechers Sep 02 '13 at 22:19
  • My apologies, I didnt mean to shout or anything.... I'll try to find my answer else where.... THANKS A MILLION FOR YOUR ASSISTANCE>... really really appreciate it. Bye :) – Shei7141 Sep 02 '13 at 22:21
  • @Shei7141 I suggested a troubleshooting approach in my last comment to your question. Did you follow these instructions? What were the results? – Ansgar Wiechers Sep 03 '13 at 10:36