Page 1 of 1

call one batch file from another

Posted: 05 Apr 2011 14:59
by cocacola
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.

Re: call one batch file from another

Posted: 05 Apr 2011 15:15
by aGerman
Probably your topic is the answer: CALL one batch file from another

Code: Select all

CALL B.bat > BUILD_DETAILS.TXT

Regards
aGerman