ECHO OFF SET first TIME START WAIT Running application SET second TIME

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
@ECHO OFF
SET first=%TIME%
START /WAIT "Running application" %1
SET second=%TIME%
ECHO Before: %first%
ECHo After: %second%
FOR /F "tokens=1,2,3 delims=:" %%A IN ("%first%") DO (
SET hour1=%%A
SET min1=%%B
SET sec1e=%%C
)
IF %hour1:~0,1% EQU 0 SET hour1=%hour1:~1%
IF %min1:~0,1% EQU 0 SET min1=%min1:~1%
FOR /F "tokens=1,2 delims=," %%A IN ("%sec1e%") DO (
SET sec1=%%A
SET millsec1=%%B
)
IF %sec1:~0,1% EQU 0 SET sec1=%sec1:~1%
IF %millsec1:~0,1% EQU 0 SET millsec1=%millsec1:~1%
FOR /F "tokens=1,2,3 delims=:" %%A IN ("%second%") DO (
SET hour2=%%A
SET min2=%%B
SET sec2e=%%C
)
IF %hour2:~0,1% EQU 0 SET hour2=%hour2:~1%
IF %min2:~0,1% EQU 0 SET min2=%min2:~1%
FOR /F "tokens=1,2 delims=," %%A IN ("%sec2e%") DO (
SET sec2=%%A
SET millsec2=%%B
)
IF %sec2:~0,1% EQU 0 SET sec2=%sec2:~1%
IF %millsec2:~0,1% EQU 0 SET millsec2=%millsec2:~1%
SET /A delta=(%hour2%*3600000+%min2%*60000+%sec2%*1000+%millsec2%)-(%hour1%*3600000+%min1%*60000+%sec1%*1000+%millsec1%)
echo Application: '%1' was ran in %delta% milliseconds