Tech Support > Microsoft Windows > calling multiple batch files from within a batch file
calling multiple batch files from within a batch file
Posted by yawnmoth on May 26th, 2008


I have two batch files - hello.cmd and hello2.cmd.

Here's the contents of hello.cmd:

@echo hello, world!

Here's the contents of hello2.cmd:

@hello
@hello

Why is "hello, world!" only output once?

Posted by smlunatick on May 26th, 2008


On May 26, 1:25*pm, yawnmoth <terra1...@yahoo.com> wrote:
You need to note that any "*.cmd files are Windows Script files and
not batch files (older DOS files.)

The first line "sends" the control over the hello, but there is no
means of return.

Add "call" to before hello

@call "hello"




Posted by Pegasus \(MVP\) on May 26th, 2008



"yawnmoth" <terra1024@yahoo.com> wrote in message
news:95e1dd1e-49d5-4e4e-8c76-83688deff0e2@w7g2000hsa.googlegroups.com...
.. . . because the first @hello invokes hello.cmd, without
control ever returning to hello2.cmd. Try this instead:

@echo off
call hello
call hello



Posted by Pegasus \(MVP\) on May 26th, 2008



"smlunatick" <yveslec@gmail.com> wrote in message
news:f1407952-74c9-4557-92c0-4820b5f6ab8a@34g2000hsf.googlegroups.com...
On May 26, 1:25 pm, yawnmoth <terra1...@yahoo.com> wrote:
You need to note that any "*.cmd files are Windows Script files and
not batch files (older DOS files.)
<snip>
=================

Mhm. What exactly is the difference betwee a "Windows Script File"
and a "Batch File"? I used to think that a "Batch File" is an ASCII
file that contains a number of commands such as copy, md, del. Batch
files have a .bat or a .cmd extension. I'm not so sure about a "Windows
Script File" - the closest that comes to my mind is a "VB Script File",
which is something else again.

Under WinNT,2000,XP and Vista, files with a .cmd extension are
treated in exactly the same way as those with a .bat extension. No
difference there.