Reputation: 247
I have a batch file, updatesipversion.bat
that is calling another batch file, template.bat
.
updatesipversion.bat
code:
set init=empty
set main=svn propget svn:externals ./3c > install\msbuild\SipBranchDefaultDetailsTemplate.txt
set error=update
set action=empty
call template.bat "%init%" "%main%" "%error%" "%action%"
set init=empty
set main=install\msbuild\SipBranchDetails.exe
set error=update
set action=empty
call template.bat "%init%" "%main%" "%error%" "%action%"
template.bat
code
set /a WAcounter=0
for %%a in (%*) do set /a WAcounter+=1
if not %WAcounter%==4 goto :Error
set WAinit=%1
set WAmain=%2
set WAerror=%3
set WAaction=%4
set /a WAcounter=0
:WAinitCommand
IF NOT %1=="empty" %WAinit:~1,-1%
:WAmainCommand
set /a WAcounter+=1
IF NOT %2=="empty" %WAmain:~1,-1%
if %errorlevel%==0 goto :WASuccess
:WAerrorMsg
IF NOT %3=="empty" echo ERROR in %WAerror:~1,-1% Trying again......
if %WAcounter% equ 10 goto :Finish
goto :WAmainCommand
:WASuccess
IF NOT %4=="empty" %WAaction:~1,-1%
exit
:Finish
exit
:Error
echo there must be 4 command line arguments
exit
pause
When the for
command in first call to template.bat call if %errorlevel==0%
then it exits
from :WASuccess
, if not it exits from :Finish
.
The second time template is not called or other command are not executed.
Please tell me if first command is exited, how to continue with making second template call.
Thanks
Upvotes: 0
Views: 2089
Reputation: 77995
You should use either start
instead of call
, or use exit /B
or goto :eof
from your called batch. See this for reference.
Upvotes: 1