call one batch file from another

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
cocacola
Posts: 1
Joined: 05 Apr 2011 14:56

call one batch file from another

#1 Post by cocacola » 05 Apr 2011 14:59

i have 2 batch files -- B.bat containing -
@ECHO OFF

ECHO TESTING 1
ECHO TESTING 2
ECHO TESTING 3
ECHO TESTING 4
ECHO TESTING 5

ECHO Pausing for review

and A.bat containing

@ECHO OFF
SETLOCAL

IF EXIST BUILD_DETAILS.TXT (
ECHO DELETING BUILD_DETAILS.TXT
DEL BUILD_DETAILS.TXT
) ELSE (
ECHO FILE MISSING
)

ECHO STOPPING FIREWALL SERVICE
NET STOP "SharedAccess"
SET BuildStartTime=%time%
ECHO Build Start Time %BuildStartTime%
ECHO .
ECHO RUNNING B.bat........
B.bat > BUILD_DETAILS.TXT
ECHO .
ECHO B.bat HAS BEEN EXECUTED...
SET BuildEndTime=%time%
ECHO Build End Time %BuildEndTime%
PAUSE
EXIT

====================================================================
A.bat call B.bat - BUILD_DETAILS.TXT gets created but the control doesnt return back to A.bat after that. I ended B.bat with PAUSE or EXIT. with PAUSE, i could see the ECHO statements of A.bat at the DOS prompt but "RUNNING B.bat........" is the last text i see.
Where am i going wrong ?

Thanks for viewing my post and helping me.

aGerman
Expert
Posts: 4678
Joined: 22 Jan 2010 18:01
Location: Germany

Re: call one batch file from another

#2 Post by aGerman » 05 Apr 2011 15:15

Probably your topic is the answer: CALL one batch file from another

Code: Select all

CALL B.bat > BUILD_DETAILS.TXT

Regards
aGerman

Post Reply