0

I have a .exe file to download data from a chip. I want to know the start time and the exit time of this program, using a .bat file, but I have no idea how to do this.

Please help me!

Thanks

  • 2
    Possible duplicate of [How to measure execution time of command in windows command line?](https://stackoverflow.com/questions/673523/how-to-measure-execution-time-of-command-in-windows-command-line) – aschipfl Jul 03 '17 at 09:40

2 Answers2

3
ECHO start: %time%
yourexecutable
echo end  : %time%

is the way I'd do it.

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • Thank you for the answer! If I want to save a print of the time in a file .txt , and maybe also the difference between the start_time and the end_time, how can I do? Is it possible? Thanks – user8247372 Jul 13 '17 at 09:26
0

In case yourexecutable scrolls / pages start time out of screen I'd prefer:

Set StartTime=%time%
ECHO start: %StartTime%
yourexecutable
Set EndTime=%time%
Echo start: %StartTime%
Echo end  : %EndTime%
Echo Yourexecutable ran form %StartTime% to %EndTime% >>"YourExe.Log"
Pause
  • Thanks a lot for the answer! If I want to save a print of the time in a file .txt , and maybe also the difference between the start_time and the end_time, how can I do? Is it possible? Thanks – user8247372 Jul 13 '17 at 09:30
  • I added logging to the above batch, for the time difference there are already [Q&A for this](https://stackoverflow.com/questions/9922498/calculate-time-difference-in-windows-batch-file) –  Jul 13 '17 at 09:46