Introduction: Stop Watch With Batch Files

About: I enjoy anything to do with computers. I have made some interesting scripts, and I am constantly improving my skill set. One day I hope to become a programmer, although in what category is still a mystery (al…
This is basically a stop watch for computers. It was "programmed" (if you can call it that) in simple MS-DOS commands. 

Simply copy and paste the following code into a text editing program, such as Wordpad, Notepad and Notepad++ and save it as "Stop Watch.bat"


Step 1: Code

Feel free to point out any mistakes I have made. This will also be going in my Mega Menu program once it is working fully. 

@echo off
set title=Stop Watch V 1
title %title%
color 0a

:start
cls
echo Press any key to start the timer or H to see the instructions
set /p start=
if %start% equ H goto help
if %start% equ h goto help
goto back

:help
cls
echo Press 1 to start/stop the timer
echo Press 2 to record a lap (maximum of three laps)
echo Press 3, when stopped, to reset the timer.
echo.
echo The timer only counts in whole seconds.
echo.
echo Press any key to go back
pause >nul
goto start

:back
set lap1=0
set lap2=0
set lap3=0
set time=-1
set reset=0
set timex=0
set timey=1
set err=0
set errx=0
set erry=0
set lap=0

:timer
title %title%
If %timex% neq 0 set /a timex=%timex%+1
If %errx% neq 0 set /a errx=%errx%+1
If %timex% geq %timey% set reset=0
if %errx% geq %erry% set err=0
If %lap3% neq 0 set lap=1
if %lap3% equ 0 set lapnum=3
If %lap2% equ 0 set lapnum=2
If %lap1% equ 0 set lapnum=1
set /a time=%time%+1
cls
If %err% neq 0 echo All three laps have values already. You cannot add any more
If %err% neq 0 echo.
If %reset% EQU 1 echo Cannot reset because time has not been stopped
echo %time% seconds
echo.
echo.
If %lap1% neq 0 echo Lap One: %lap1% seconds
If %lap2% neq 0 echo Lap Two: %lap2% seconds
If %lap3% neq 0 echo Lap Three: %lap3% seconds
echo.
echo.
echo 1 = Start/Stop
echo 2 = Lap
echo 3 = Reset (once stopped)
echo.
choice /c 123c /n /t 1 /d c
if %ERRORLEVEL% equ 1 goto stop
if %ERRORLEVEL% equ 2 goto lap
if %ERRORLEVEL% equ 3 set timex=%time%
if %ERRORLEVEL% equ 3 set /a timey=%timex%+3
if %ERRORLEVEL% equ 3 set reset=1
if %ERRORLEVEL% equ 3 goto timer
If %ERRORLEVEL% equ 4 goto timer

:stop
title %title% ~ Stopped
cls
echo %time% seconds
echo.
echo.
If %lap1% neq 0 echo Lap One: %lap1% seconds
If %lap2% neq 0 echo Lap Two: %lap2% seconds
If %lap3% neq 0 echo Lap Three: %lap3% seconds
echo.
echo.
echo 1 = Start/Stop
echo 2 = Lap
echo 3 = Reset (once stopped)
echo.
choice /c 123 /n
If %ERRORLEVEL% equ 1 goto timer
If %ERRORLEVEL% EQU 2 set lap%lapnum%=%time%
If %ERRORLEVEL% equ 3 goto reset

:lap
if %lap% equ 1 set errx=0
if %lap% equ 1 set erry=3
if %lap% equ 1 set err=1
if %lap% equ 1 goto timer
cls
set lap%lapnum%=%time%
set time=-1
goto timer

:reset
cls
set lap1=0
set lap2=0
set lap3=0
set time=0
set reset=0
set timex=0
set timey=1
set err=0
set errx=0
set erry=1
set lap=0
goto stop

P.S: I searched "images" on Google Images to find my last two photos. They are not mine, I do not claim they are mine. I have no right over them.

Step 2: Credit

If you wish to use this, like any of my tid-bits, you must do a series of things first:

1. Ask me for permission (I will say yes, but I want to know that your using it).
2. Give me credit for it in your program.
3. Send me a link or send me the program itself.

I am under the by-nc-sa license which states that you may use my program non commercially, so long as credit is given. 

Feel free to ask for help on a project.