Can you help me get a VBS script I made to work?

Hitesh Nair March 19, 2012
Pinterest Stumbleupon Whatsapp
Ads by Google

I made a VBS script, but it’s not working. There is some error. Please correct it—

@echo off
color b0
:menu
cls
echo Hey! Welcome to the Voltage Grand Quiz !
To select your choice, type the number near it and click Enter button.
echo 1) Start The Quiz

echo 2)
How To Play
echo 3)
I Give Up
set /p number=

if %number% == 1 goto StartGame
if %number% == 2 goto help
if %number% == 3 goto exit

:startgame
cls
echo Type Your Name:
set /p name=
echo Hello %name%!
echo Do you want to start the quiz? (y/n)
set /p start=
if %start% == y goto level1
if %start% == n goto menu
goto startgame

:help
cls
echo Press the number of the answer then hit enter.
echo Start The Game ?? (y/n)
set /p menugoto=
if %menugoto% == y goto level1
if %menugoto% == n goto menu
goto help

:exit
goto exit

:level1
cls
echo Okay, Let’s Start.
echo What is the full form of IP in IP Address ??
echo 1) Internet Province
echo 2) Internet Protocol
echo 3) Internet Provider

set /p answer1=
if %answer1% == 1 goto wrong1
if %answer1% == 2 goto correct1
if %answer1% == 3 goto wrong1
goto level1

:correct1
echo You are right! Next Level? (y/n)
set /p NL1=

if %NL1% == ygoto level2
if %NL1% == n goto menu
goto correct1

:Wrong1
Echo Sadly, you were wrong. Retry? (y/n)
set /p WA1=
if %WA1% == y goto level1
if %WA1% == n goto menu
goto wrong1

:level2

cls
echo Who is on the 100 dollar bill?
echo 1) Ben Franklin
echo 2) Tommy King
echo 3) Thomas Train
echo 4) Jeff Dunham
set /p aa=
if %aa% == 1 goto correct2
if %aa% == 1 goto wrong2
if %aa% == 1 goto wrong2
if %aa% == 1 goto wrong2
goto level2

:correct2
cls
echo YOU WIN THE GAME!
goto correct2

:wrong2
cls
echo You lost this time, but keep trying !! RETRY GAME? (y/n)
set/p retry=
if %retry% == y goto level1
if %retry% == n goto exit
goto wrong2

  1. Chris Bell
    March 20, 2012 at 1:36 am

    if %NL1% == ygoto level2   there is your error.... you haven't spaced the y away from the goto statement....

  2. Mike
    March 19, 2012 at 6:36 pm

    other than the infinite loop at ":correct2" it seems to be fine

    not sure whether it was Disqus or your code ~ make sure that there is no line break at the "echo" commands

  3. Hitesh Nair
    March 19, 2012 at 2:07 pm

    I'm sorry. Its a .bat script and you run it in cmd (command prompt).

    Hitesh Nair