Can someone help me with this .bat program?

I created a .bat program in Notepad. I was wondering how to do, because it's something new I learn and I started yesterday only. So today, I thought I'd do a. But unfortunately, I couldn't get through it, can someone tell me if this is the correct syntax.
BTW, the problem was, once the menu main departure happens and when I press 1, 2, 3, or 4, nothing happens and it closes abruptly. The PROGRAM GOES LIKE THIS:

  • off @echo
  • color 1F
  • title age identifier

  • : menu
  • CLS
  • Welcome to the identifier of the age of echo
  • ECHO, what is your age?
  • Echo 1) under 18
  • Echo 2) equal to or less than 18 years old but less than 60 greator
  • ECHO 3) 60 greator
  • the echo 4) output
  • define opta / p =

  • If opta % = 1 then goto minor
  • If opta % = 2 then goto adult
  • If opta % = 3 then goto Senior
  • If opta = 4% then goto bye

  • : Minor
  • CLS
  • You are a miner of the echo
  • echo return? (y/n)
  • Set /p backa =

  • If menu = % backa can goto
  • Backa % = n If then goto bye

  • : Adult
  • CLS
  • You are an adult of the echo
  • echo Go Back? (y/n)
  • Set /p backb =

  • If backb % = menu there then goto
  • If backb % = n then goto bye

  • : Senior
  • CLS
  • You are a senior echo
  • echo Go Back? (y/n)
  • Set /p backc =

  • Backc = menu % if there then goto
  • Backc % = n If then goto bye

  • : bye
  • echo BYE!


PLEASE HELP ME AND THANK YOU IN ADVANCE!

To use variables created in .cmd script, you must add the command "SETLOCAL" before.
Also you do not use good operator "==" in the construction of the IF command to compare strings and there is also no "then" keyword in the construction of this command.
E.g.
::
off @echo
setlocal
echo what is your favorite food?
Set /p food =
If food % == fried echo Wow! I also love food %!
ENDLOCAL
pause
::

Output:
What is your favorite food?
Fries
Wow! I love the fries too!

You can check for more information on the syntax with and controls:
cmd /?
Or
Help

Tags: Windows

Similar Questions

Maybe you are looking for