Page 1 of 1

measrue elapsed time

Posted: 10 Dec 2019 06:32
by Userdosfx
hi
i want to learn how to measure elapsed time when start some process like counting of min,hours?

thank you

Re: measrue elapsed time

Posted: 10 Dec 2019 07:09
by miskox

Re: measrue elapsed time

Posted: 28 Dec 2019 08:00
by Userdosfx
I need something like stopwatch examples
Not those examples

Re: measrue elapsed time

Posted: 28 Dec 2019 10:30
by carlos
Hello, have you tried Enhanced Batch?

You can measure the time using the extension @timer, as in this example:

Code: Select all

@Echo off
Rundll32 "%~dp0enhancedbatch_%processor_architecture%" load
If Not Defined @enhancedbatch (
Echo Load Failed
Goto :Eof
)

set @delayedexpansion=1
set @echooptions=0

call @timer start

:: execute here your command
:: ping as example
ping.exe example.com

call @timer stop
echo
echo Elapsed milliseconds: !@timer!

pause
it prints:

Code: Select all

Pinging example.com [93.184.216.34] with 32 bytes of data:
Reply from 93.184.216.34: bytes=32 time=145ms TTL=49
Reply from 93.184.216.34: bytes=32 time=139ms TTL=49
Reply from 93.184.216.34: bytes=32 time=137ms TTL=49
Reply from 93.184.216.34: bytes=32 time=136ms TTL=49

Ping statistics for 93.184.216.34:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 136ms, Maximum = 145ms, Average = 139ms

Elapsed milliseconds: 3266
Press any key to continue . . .

Re: measrue elapsed time

Posted: 30 Dec 2019 08:31
by Squashman
Userdosfx wrote:
28 Dec 2019 08:00
I need something like stopwatch examples
Not those examples
Explain to us how using GetTimeStamp or JTimeStamp does not working for you in a stopwatch like fashion.