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

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
waaraa1331
Posts: 3
Joined: 21 Jul 2009 09:19

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

#1 Post by waaraa1331 » 21 Jul 2009 09:27

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

avery_larry
Expert
Posts: 391
Joined: 19 Mar 2009 08:47
Location: Iowa

#2 Post by avery_larry » 21 Jul 2009 13:49

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!

waaraa1331
Posts: 3
Joined: 21 Jul 2009 09:19

#3 Post by waaraa1331 » 21 Jul 2009 14:03

I had not used call and now that I try it, it works perfectly. Thank you very much!

Post Reply