@echo off set t1=%time% call:Process %1 goto end :Process for %%a in ("%1") do ( set file_path=%%~dpa ) echo %file_path% cd . > %file_path%test\out.txt for %%i in ( %file_path%test\in*.txt) do ( echo ## %%i >> %file_path%test\out.txt echo %date% %time% >> %file_path%test\out.txt call:time_start %1 < %%i >> %file_path%test\out.txt call:time_diff >> %file_path%test\out.txt ) goto:eof :time_start set t1=%time% goto:eof :time_diff set t2=%time% set /a ms=1%t1:~9%*10 %% 1000 set /a sec=1%t1:~6,2% %% 100 set /a min=1%t1:~3,2% %% 100 set /a hour=%t1:~0,-9% set /a time1 = %hour% * 3600000 + %min% * 60000 + %sec% * 1000 + %ms% set /a ms=1%t2:~9%*10 %% 1000 set /a sec=1%t2:~6,2% %% 100 set /a min=1%t2:~3,2% %% 100 set /a hour=%t2:~0,-9% set /a time2 = %hour% * 3600000 + %min% * 60000 + %sec% * 1000 + %ms% set /a time_dif = %time2% - %time1% echo; echo ----------------------------------------------- echo Process exited after %time_dif% ms with return value %ErrorLevel% echo; goto:eof :end REM pause