I'm creating a reminder which pops up a text file when a certain period of time passes and what I want to implement is a countdown (how many seconds and minutes are left until the upcoming loop begins). Everything seems to be going fine, until the part where I try to integrate minutes and seconds into one line. It gives me a "300 not expected here"
error after the line echo Left (in minutes): %leftMinutes%
. Any and all help would be appreciated.
Code
:Start
set /a wait = 0
set /a waitMinutes = 0
set /a left59 = %real_time% - 59 :: %real_time% is the inputed minutes,
:: converted to seconds.
cls
color 0a
for /f "delims=" %%a in (Notes.txt) do (
set notes=%%a
)
cd %~dp0/Notes
start Notes.txt
goto Loop
:Loop
cls
echo Waiting for %answer_time% minutes.
echo.
set /a leftSeconds = %real_time% - %wait%
echo Left (in seconds): %leftSeconds%
set /a leftMinutes = %answer_time% - %waitMinutes%
echo Left (in minutes): %leftMinutes%
if %wait% LSS %left59% ( :: Checks if there's one more minute left in
:: %real_time%.
if %wait% GEQ %left59% ( :: Checks if there's no more minutes left
:: in %real_time%.
echo Left (both): %leftSeconds%
)
echo Left (both): %leftMinutes% and %leftSeconds%
)
timeout -t 1 -nobreak > nul
set /a wait += 1
if %wait% == 60 (
set /a waitMinutes += 1
)
if not %wait% == %real_time% (
goto Loop
)
if %wait% GEQ %real_time% (
if %waitMinutes% == %answer_time% (
taskkill -f -im Notepad.exe
goto Start
)
)