Computing Staff
  • 3

2 Was Unexpected At This Time Batch

  • 3

I’m getting this error while trying to write an
interactive batch file. I can’t seem to get the
error level configured right the part I’m having
problems with is:

:FEELING determine how subject feels
ECHO. Good…G
ECHO. Bad….B
ECHO.
choice /m “Please choose:” /c:bg /n
ECHO.

::Determine what option was chosen
IF ERROLEVEL 2 GOTO FEELSBAD
IF ERROLEVEL 1 GOTO FEELGOOD

Can you please help?

Share

2 Answers

  1. What you have works on older model systems, but might not in Vista (i don’t have vista), but you might try this variation:
    if %errorlevel% equ 2 goto Feelsbad
    if %errorlevel% equ 1 goto Feelsgood
    note that this version WON’T work on older systems!
    or:
    if errorlevel==2
    (no percentsigns!)
    might work, can’t test Vista, works on ME.

    • 0