timer - Setting up batch if statements correctly -


i've written timer batch script can compare real time execution of file vs internal run time looks this:

@echo off setlocal enabledelayedexpansion cls  /f "delims=_" %%j in ('forfiles /p "%%f" /m *.ext /c "cmd /c echo @path"') (     set start=!time!     echo start time: !start!     start "program" /d "c:program files\path\to\program"     set end=!time!     echo end time: !end!      /f "tokens=1-4 delims=:.," %%a in ("!start!") (         set /a "start=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"     )         /f "tokens=1-4 delims=:.," %%a in ("!end!") (         set /a "end=(((%%a*60)+1%%b %% 100)*60+1%%c %% 100)*100+1%%d %% 100"     ) set /a elapsed=end-start if !elapsed! lss 0 set /a elapsed + 8640000  echo elapsed time: !elapsed! 

the second last line if statement there solve problem of script running past midnight however, doesn't seem working , i'll still negative times. can spot error here?

additionally, i'd create layer of error reporting aforementioned line of code functioning perfectly, i'd add layer of if set !elapsed! = null if negative. important note i'm still new batch , learning of go.

read set /a command line reference or great resource. therefore, line follows:

if !elapsed! lss 0 set /a "elapsed+=8640000" 

or (giving same result)

if !elapsed! lss 0 set /a "elapsed = elapsed + 8640000" 

Comments

Popular posts from this blog

Magento/PHP - Get phones on all members in a customer group -

php - .htaccess mod_rewrite for dynamic url which has domain names -

Website Login Issue developed in magento -