Technology Questions

Go Back   Technology Questions > Software Questions > Operating System Questions > Windows XP

Windows XP Discuss the Microsoft Windows XP Operating System

Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old 05-26-2008, 10:30 AM
yawnmoth
Newsgroup Contributor
 
Posts: n/a
calling multiple batch files from within a batch file

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?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

 
Old 05-26-2008, 10:30 AM
  #2 (permalink)  
Old 05-26-2008, 10:40 AM
smlunatick
Newsgroup Contributor
 
Posts: n/a
Re: calling multiple batch files from within a batch file

On May 26, 1:25*pm, yawnmoth <terra1...******.com> wrote:
> 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?


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"



Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #3 (permalink)  
Old 05-26-2008, 10:40 AM
Pegasus \(MVP\)
Newsgroup Contributor
 
Posts: n/a
Re: calling multiple batch files from within a batch file


"yawnmoth" <terra1024******.com> wrote in message
news:95e1dd1e-49d5-4e4e-8c76-83688deff0e2@w7g2000hsa.googlegroups.com...
>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?


.. . . because the first @hello invokes hello.cmd, without
control ever returning to hello2.cmd. Try this instead:

@echo off
call hello
call hello


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

  #4 (permalink)  
Old 05-26-2008, 10:50 AM
Pegasus \(MVP\)
Newsgroup Contributor
 
Posts: n/a
Re: calling multiple batch files from within a batch file


"smlunatick" <yveslec******.com> wrote in message
news:f1407952-74c9-4557-92c0-4820b5f6ab8a@34g2000hsf.googlegroups.com...
On May 26, 1:25 pm, yawnmoth <terra1...******.com> wrote:
> 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?


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.


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multiple commands in batch file loop mrgou Windows Vista 7 03-24-2009 03:44 AM
Dispatching tasks to multiple cores from a batch file adish Windows XP 8 04-30-2008 11:50 PM
Batch file works in command line but not as a batch Danger Windows XP 7 02-05-2008 09:00 AM
Batch file to start multiple programs at once, without delay. Zytan Windows XP 1 06-01-2007 12:00 PM
Save batch window msgs to a file from the batch prog Stephen Rainey Windows XP 3 01-09-2007 06:15 PM


New To Technology Questions? Do You Need Help with Your Computer or Device? Do You Need Help with this site?

All times are GMT -8. The time now is 01:34 AM.


2003 - 2009 All Rights Reserved. Technology Questions

Search Engine Friendly URLs by vBSEO 3.3.0