See if this is what you are looking for:
First batch file
Code:
@echo off
::Batch File One (bat1.cmd)
cls
dir *.tmp
echo Calling Second Batch File...
pause
call bat2.cmd 1
echo Back to First Batch File...
echo Calling Second Batch File...
pause
call bat2.cmd 2
echo Back to First Batch File...
Second batch file
Code:
@echo off
::Batch File two (bat2.cmd)
cls
if "%1" EQU "" goto :eof
call :%1
goto :eof
:1
Echo Running commands from second batch file passing 1 as parameter...
pause
dir *.txt
goto :eof
:2
Echo Running commands from second batch file passing 2 as parameter...
pause
dir *.doc
goto :eof
The second batch file will do nothing unless a parameter is passed to it on the command line. This can be changed if needed, but should give you the idea of calling one batch file from another, running a specified sub-routine, and then return to the calling batch file.
Scr1ptW1zard