자유 게시판

배치파일 시간 측정

2020.12.29 11:33

arim 조회:473 추천:5

@echo off & title 백분의 일초 & cd /d %~dp0 & call :now

set /a tim1=m*6000+s*100+s'

set m=  %m%& set s=  %s%& set s'=  %s'%

set st=시작 시각   %m:~-2% 분 %s:~-2% 초 %s':~-2%

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo.

 

::여기에 배치문을 넣어서 실행 시간을 알수 있습니다.

::날짜가 바뀌는 순간에는 에러가 납니다.

 

echo.

:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

echo  에러 레벨    %errorlevel%

call :now

set /a tim2=m*6000+s*100+s'

if %tim2% lss %tim1% set /a tim2+=360000

set /a ela=tim2-tim1

set /a ma=ela/6000, res=ela%%6000, sa=res/100, sa'=res%%100

set m=  %m%& set s=  %s%& set s'=  %s'%

set ma=  %ma%& set sa=  %sa%& set sa'=  %sa'%

echo  %st%

echo  마친 시각   %m:~-2% 분 %s:~-2% 초 %s':~-2%

echo  걸린 시간   %ma:~-2% 분 %sa:~-2% 초 %sa':~-2%

echo  끝내려면 아무키나 누르세요. & pause >nul & exit

:now

set tim0=%time%

if %tim0:~3,1%==0 (set /a m=%tim0:~4,1%) else (set /a m=%tim0:~3,2%)

if %tim0:~6,1%==0 (set /a s=%tim0:~7,1%) else (set /a s=%tim0:~6,2%)

if %tim0:~-2,1%==0 (set /a s'=%tim0:~-1%) else (set /a s'=%tim0:~-2%)

exit /b

 
인코딩은 UTF-8 => ANSI 한글 표현이 편합니다.
 
A.png

 

XE1.11.6 Layout1.4.8