Page 1 of 1

Running 2 .bat files in a third .bat file problem

Posted: 21 Jul 2009 09:27
by waaraa1331
Hello,
I have written 2 scripts, A and B. A creates directories and moves files to those directories while B runs a program that uses those files and directories. I have put A and B in script C which is suppose to run A and B (and eventually a few more scripts).

My problem is that after script A has finished the command window closes and never runs script B. I am fairly new to scripting so I feel like this is a quick fix and I am overlooking something. Any help would be greatly appreciated.

Thanks

Posted: 21 Jul 2009 13:49
by avery_larry
Did you use call? If you don't call another batch file, then control is passed permanently to the other batch file, instead of temporarily:

batchc.cmd

Code: Select all

call batcha.cmd
call batchb.cmd
echo WooHoo!

Posted: 21 Jul 2009 14:03
by waaraa1331
I had not used call and now that I try it, it works perfectly. Thank you very much!