1.

Solve : Can't compile - Syntax Error??

Answer»

I'm running Windows Vista and the Firefox browser. My question is:

Hey, I was mucking around and made a timer that adds a second whenever the system clock has changed - yeah I know its pretty basic and can be largely improved - though when I TRIED to compile it with bat2exe I get a syntax error? (Line 45) - I'm not sure if the line includes blank lines or NOTES though?

Code: [Select]@echo off
title System Timer
color F0

:START
mode 45,6
set min=0
set mio=00
set sec=0
set seo=00
cls
echo.
echo Press Any Key to start timing.
echo.
echo Press Ctrl+C to end.
pause >NUL
cls
mode 26,8
set ctime=%time:~6,2%
set stime=%time:~0,8%

echo.
echo Started at : %stime%
echo.
echo Current time is: %time:~0,8%
echo.
echo Timer records : %mio%:%seo%

goto RUN

:RUN
rem CHECK SECOND
if not "%ctime%"=="%time:~6,2%" (
goto SEC
) ELSE (
goto RUN
)
:SEC
rem CHANGE SECOND
set /a sec+=1
set ctime=%time:~6,2%

rem ADD MINUTE?
if "%sec%"=="60" (
set /a min+=1 <<<LINE 45>>>
set sec=0
)

rem ADD PREFIX 0 TO SECOND?
if %sec% LEQ 9 (
set seo=0%sec%
) else (
set seo=%sec%
)

rem ADD PREFIX 0 TO MINUTE?
if %min% LEQ 9 (
set mio=0%min%
) else (
set mio=%min%
)

rem DISPLAY ADJUSTED TIMES
cls
echo.
echo Started at : %stime%
echo.
echo Current time is: %time:~0,8%
echo.
echo Timer records : %mio%:%seo%
)

goto RUN
Code: [Select]set /a min=%min% +1
I wish += and -= would work, though.Quote from: Dark Blade on JUNE 18, 2007, 02:41:30 AM

Code: [Select]set /a min=%min% +1
I wish += and -= would work, though.
They do, at least in Vista they do, and changing doesn't change anything.

Quote

C:/>set /?
...
= *= /= %= += -= - assignment
...
Well, I haven't used Vista before, so I was just guessing that they wouldn't have changed COMMAND Prompt.

Maybe you could do (for the line below) set /a, instead of set. But that's just my guess.Quote from: Dark Blade on June 18, 2007, 03:01:13 AM
Well, I haven't used Vista before, so I was just guessing that they wouldn't have changed Command Prompt.

Maybe you could do (for the line below) set /a, instead of set. But that's just my guess.
No luck, I'm downloading a better compiler now anyway - maybe it can do it.

Thanks anyway.


Discussion

No Comment Found