ReneGe
asked on
Batch File: Add seconds
Hi there,
BillPrew recently did this batch file for me.
I would now like to add seconds to it.
Reference:
https://www.experts-exchange.com/questions/27476219/Batch-File-Easy-math.html?anchorAnswerId=37231426#a37231426
Thanks,
Rene
BillPrew recently did this batch file for me.
I would now like to add seconds to it.
Reference:
https://www.experts-exchange.com/questions/27476219/Batch-File-Easy-math.html?anchorAnswerId=37231426#a37231426
Thanks,
Rene
@echo off
setlocal
set SpeedInKM=120
set KMtoGo=157
for /F "tokens=1,2" %%A in ('WMIC Path Win32_LocalTime Get Hour^,Minute ^| FINDSTR /R [0123456789]') do (
set EndHour=%%A
set EndMinute=%%B
)
call :DisplayTime "Start Time" %EndHour% %EndMinute%
set /A Hours=KMtoGo / SpeedInKM
set /A Minutes=(60 * (KMtoGo - (Hours * SpeedInKM))) / SpeedInKM
call :DisplayTime "Elapsed time" %Hours% %Minutes%
set /A EndHour=(EndHour + Hours + ((EndMinute + Minutes) / 60)) %% 24
set /A EndMinute=(EndMinute + Minutes) %% 60
call :DisplayTime "Arrive Time" %EndHour% %EndMinute%
pause
exit /b
:DisplayTime [heading] [hour] [minute]
set "_h=0%~2" & set "_m=0%~3"
echo %~1 = %_h:~-2%:%_m:~-2%
exit /b
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Show off ;)
:-)
ASKER
Thanks Bill for showing off ;)