slyfox1186

convert_time_hh:mm:ss_total_duration.bat

Sep 25th, 2021 (edited)
953
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @ECHO OFF
  2. SETLOCAL ENABLEEXTENSIONS
  3. COLOR 0A
  4. TITLE CONVERT TOTAL TIME DURATION IN HH:MM:SS FORMAT
  5.  
  6. :----------------------------------------------------------------------------------
  7.  
  8. REM CREATED BY: SLYFOX1186
  9. REM WEB: https://pastebin.com/u/slyfox1186
  10.  
  11. REM CONVERT START TIME + STOP TIME = TOTAL TIME DURATION
  12. REM TIME FORMAT: HH:MM:SS
  13.  
  14. REM THE SCRIPT WILL PROMPT THE USER TO ENTER THE
  15. REM START AND STOP TIMES
  16.  
  17. :----------------------------------------------------------------------------------
  18.  
  19. REM SET WORKING DIRECTORY TO THE SCRIPT'S DIRECTORY
  20. PUSHD "%~dp0"
  21. IF NOT "%1"=="MAX" START /MAX CMD /D /C %0 MAX & GOTO :EOF
  22.  
  23. :----------------------------------------------------------------------------------
  24.  
  25. REM SET VARIABLES
  26. ECHO=
  27. SET /P "StartPosition=Start Position (HH:MM:SS): "
  28. SET /P "EndPosition=End Position (HH:MM:SS):   "
  29. SET /A "ss=(((1%EndPosition::=-100)*60+1%-100)-(((1%StartPosition::=-100)*60+1%-100)"
  30. SET /A "hh=ss/3600+100,ss%%=3600,mm=ss/60+100,ss=ss%%60+100"
  31.  
  32. :----------------------------------------------------------------------------------
  33.  
  34. REM ECHO THE RESULTS TO THE CMD WINDOW
  35. ECHO=
  36. ECHO Duration = %hh:~1%:%mm:~1%:%ss:~1%
  37. PAUSE >NUL
  38.  
  39. :----------------------------------------------------------------------------------
  40.  
  41. REM ADD OUTPUT TO WINDOWS CLIPBOARD
  42. ECHO %hh:~1%:%mm:~1%:%ss:~1%|CLIP
  43. REM OUTPUT DURATION TO TEXT FILE IN THE SCRIPT'S DIRECTORY
  44. ECHO %hh:~1%:%mm:~1%:%ss:~1%>"duration.txt"
RAW Paste Data