Multiple batch files or single batch file?

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Multiple batch files or single batch file?

#1 Post by Acy Forsythe » 20 Jun 2011 14:32

I know the answer may actually depend on the task at hand, but in general practice do you...

A: Typically manage multiple tasks in a single large batch file?

B: Setup multiple batch files to handle individual tasks and then manage the process from a single main batch file?

Are there pros/cons or is it just preference?

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Multiple batch files or single batch file?

#2 Post by Ed Dyreen » 20 Jun 2011 15:22


A is too slow, B is too fragmented, How about C, a little of both ! :P

#include Math.CMD
#include User.CMD
#include Network.CMD

A is fast, C and B are just exponentially faster, I say a good cpu is the best way to mask a bad programmer !
Last edited by Ed Dyreen on 20 Jun 2011 15:50, edited 5 times in total.

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Multiple batch files or single batch file?

#3 Post by orange_batch » 20 Jun 2011 15:29

I go with A, unless I have different batch jobs that require the same resource functions. And A isn't slow, unless you're Ed. :roll:

Acy Forsythe
Posts: 126
Joined: 10 Jun 2011 10:30

Re: Multiple batch files or single batch file?

#4 Post by Acy Forsythe » 20 Jun 2011 15:36

I've always gone with option A. With the exception that a lot of my automated tasks revolve around SQL data and displaying html indexes on the fly, so my "A" is usually required to generate and then execute dynamic scripts. So technically it's more than one batch and a few .sql scripts, but they are temporary and all the code is in one file.

Now that I've been messing with the concept of libraries I was beginning to wonder if I was just doing it "wrong" or "inefficient".

Ed Dyreen
Expert
Posts: 1569
Joined: 16 May 2011 08:21
Location: Flanders(Belgium)
Contact:

Re: Multiple batch files or single batch file?

#5 Post by Ed Dyreen » 20 Jun 2011 15:51


"wrong" or "inefficient"

No you are doing great, orange seems to know everything about it, use many functions, and many calls inside a single batch, especially at places you don't have to, that should do it :D

orange_batch
Expert
Posts: 442
Joined: 01 Aug 2010 17:13
Location: Canadian Pacific
Contact:

Re: Multiple batch files or single batch file?

#6 Post by orange_batch » 20 Jun 2011 17:59

Image

Post Reply