It would depend on whether there was any interaction between the batch files!
Presumably there's a reason why you don't just put the code from the other two batch files 'in line' into the first and only batch file, saving the clock time when you start, and work out the elapsed time when you've finished? or do
:: save start time in a variable
call batch-file-one
call batch-file-two
:: save end time in another variable
:: calculate elapsed time and send out email message (using BLAT?)
Without knowing how you want to display the elapsed time, here's something which works out the elapsed time in milliseconds.
Code: Select all
call :timer start
:: lots of Stuff happens here now, which is to be timed
call :timer
goto :eof
::-----------------------------------------------------------------------------
:timer function: resolution quantum is 10 ms;
:: variable %TIMER% holds number of milliseconds since midnight
setlocal
:: get the current hours/minutes/seconds/centiseconds since midnight
for /f "tokens=5-8 delims=:,. " %%a in ('echo:^|time') do (
set /a hh=%%a,mm=1%%b-100,ss=1%%c-100,cc=1%%d-100
)
if /i "%1"=="start" set timer=0
set /a timer=hh*3600000+mm*60000+ss*1000+cc*10-timer
:: VV note that the /i parameter is not displayed in ECHOed statements
if /i not "%1"=="start" echo Elapsed time = %timer% msec
endlocal & set timer=%timer%