In batch file, I query the date/time via WMIC, then reconfiguring it a "YYYYMMDD.HHMMSS" format...
@Echo Off
Cls
SetLocal EnableDelayedExpansion EnableExtensions
Call :DATETIME
Echo.
Echo %DateTime%^|Info^|Process started...
REM DO STUFF
Ping -n 8 localhost>Nul 2>Nul
REM FINISH DOING STUFF
Call :DATETIME
Echo.
Echo %DateTime%^|Info^|Process complete.
REM CALCULATE DIFFERENCE BETWEEN START AND FINISH DATETIME STAMPS HERE
Echo.
Echo Run time was [days_and-or_hours_and-or_minutes_and-or_seconds].
EndLocal
Exit /B
:DATETIME
For /F "Tokens=* Delims=" %%A In ('WMIC OS Get LocalDateTime ^|Find "."') Do @Set DT=%%A
Set Year=%DT:~0,4%
Set Month=%DT:~4,2%
Set Day=%DT:~6,2%
Set Hour=%DT:~8,2%
Set Minute=%DT:~10,2%
Set Second=%DT:~12,2%
Set DateTime=%Year%%Month%%Day%.%Hour%%Minute%%Second%
Goto :EOF
How can I calculate the date/time difference (it may go over one day) between those two custom date/time stamps? It seems like it should be a simple task, but just can't figure it out.
Thanx in advance.