Я вот так сделал:
Код:
![Выделить весь код](images/misc/selectcode.png)
@echo off
call :TimeCountBegin
ping -n 5 localhost
call :TimeCountEnd
pause
exit
:TimeCountBegin
set begin_HH=1%time:~0,2%
set /a begin_HH=%begin_HH%-100
set begin_MM=1%time:~3,2%
set /a begin_MM=%begin_MM%-100
set begin_SS=1%time:~6,2%
set /a begin_SS=%begin_SS%-100
goto :EOF
:TimeCountEnd
set end_HH=1%time:~0,2%
set /a end_HH=%end_HH%-100
set end_MM=1%time:~3,2%
set /a end_MM=%end_MM%-100
set end_SS=1%time:~6,2%
set /a end_SS=%end_SS%-100
set /a begin=(%begin_HH%*3600)+(%begin_MM%*60)+%begin_SS%
set /a end=(%end_HH%*3600)+(%end_MM%*60)+%end_SS%
set /a worktime=%end%-%begin%
set /a worktime_MM=%worktime%/60
set /a worktime_SS=%worktime%-%worktime_MM%*60
if %errorlevel%==0 echo. && echo Время обработки %worktime_MM% минут %worktime_SS% секунд.
goto :EOF