How to execute the DOS shell script in background?

Have two small DOS shell script in a big DOS script like
Big.bat
....
  small1.bat
  small2.bat
....
Would like to run the two small scripts in parallel like in Unix with &.
Can it be done?
jl66Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad HoweDevOps ManagerCommented:
You can do the following.

Big.Bat
...
start cmd.exe /C small1.bat      
start cmd.exe /C small2.bat
...

Or you can use the "&&" which is a conditional combination. It executes small2 only if small1 completes successfully.

cheers,
Hades666
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Steve KnightIT ConsultancyCommented:
Was going to say the same but beaten to it (got called away).  Only thing I'd add is you don't NEED to use the cmd.exe /c construct as it works as well without but START is your answer anyway!

Steve
0
Steve KnightIT ConsultancyCommented:
oh and watch out if you have any spaces in your path.  If you do then

START "some file.cmd"

doesn't work as it starts a window with the title "some file.cmd" as the first parameter in qutoes is the window title. So... you should generall either do:

START "" "some file.cmd"
or
START "title for this window" "some file.cmd"
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Bill PrewCommented:
The START command is likely part of this solution, as mentioned above.  The question I have would be do you want BIG.BAT to continue to process any remaining logic after it starts the two other bat files, and not wait for either to finish?  If so then the START approach above is likely what you are after.

But if you want to run both SMALL1 and SMALL2 in parallel, and not continue on until boght have finished, then that will take a different approach.

~bp
0
Steve KnightIT ConsultancyCommented:
true, and quite messy too potentially!
0
Brad HoweDevOps ManagerCommented:
Agreed. I would much rather code this in perl using the Parallel::ForkManager :).
Hades666
0
jl66Author Commented:
Thank all of you so much for the info. I will verify each of them.
0
jl66Author Commented:
Excellent answers, esp. after all the discussions.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.