@Echo off if not Exist "%1" ( Echo %1 is not exist. Exit /b 1 ) if not Exist "%2" ( Echo %2 is not exist. Exit /b 1 ) SetLocal EnableDelayedExpansion Set min=0 Set c=0 Set fg=0 for %%i in (*.dat) do ( if "%%i" == "%1" Set fg=1 if "!fg!" == "1" ( Echo. Echo %%i LogReader.exe %%i temp Set /a min+=!ERRORLEVEL! Set /a c+=1 Echo. ) if "%%i"=="%2" goto End ) :End Set /a hour=%min%/60 Set /a min-=%hour%*60 Echo. Echo ------------------------- Echo 日数 %c%日 Echo 合計 %hour%時間 %min%分 Set /a min=(%min%+%hour%*60)/c Set /a hour=%min%/60 Set /a min-=%hour%*60 Echo 平均 %hour%時間 %min%分 EndLocal