Questionnaire par lot

Solved
Bonjour,
I have created a batch questionnaire, but I made a mistake and I can't find my error. Can you help me? My batch:
@echo off
:start
title Questionnaire
@cls
color 0F
echo.
echo Question: What is the extension of batch files?
echo.
echo 1 = ".bat"
echo 2 = ".batch"
echo 3 = ".dos"
echo 4 = ".ms-dos"
echo.
set /p REP=Your answer (number):
if "%REP%"=="1" goto REP_OK
goto REP_KO

:REP_OK
@cls
color 02
echo.
echo WELL DONE, that's the correct answer!!!
echo.
pause

:REP_KO
@cls
color 0C
echo.
echo NO, that is not the correct answer!!!
echo.
pause
call "C:\your_prog.exe"
@echo off
:start
@cls
color 0F
echo.
echo Question: What is the extension of text files?
echo.
echo 1 = ".jar"
echo 2 = ".txt"
echo 3 = ".rar"
set /p REP=Your answer (number):
if "%REP%=="2" goto REP_OK
goto REP_OK

:REP_OK
@cls
color 02
echo.
echo WELL DONE, that's the correct answer!!!
echo.
pause
exit

:REP_KO
@cls
color 0C
echo.
echo NO, that is not the correct answer!!!
echo.
pause
call "C:\your_prog.exe <br />exit
I am a beginner^^
Configuration: Windows Vista Internet Explorer 8.0

6 answers

  1. I found your questionnaire a bit strange.
    I modified it a little.
    Look at the code and try to understand it:

    @echo off title Questionnaire set question=1 goto %question% :1 cls color 0F echo. echo Question: What is the extension of batch files? echo. echo 1 = ".bat" echo 2 = ".batch" echo 3 = ".dos" echo 4 = ".ms-dos" echo. set /p REP=Your answer (number): :: IF THE ANSWER IS 1 Else if "%REP%"=="1" (goto REP_OK) else goto REP_KO :2 cls color 0F echo. echo Question: What is the extension of text files? echo. echo 1 = ".jar" echo 2 = ".txt" echo 3 = ".rar" set /p REP=Your answer (number): if "%REP%=="2" goto REP_OK goto REP_OK :REP_OK cls ::ADD 1 TO THE VARIABLE "QUESTION" set /a question+=1 color 02 echo. echo WELL DONE, that’s the right answer!!! echo. pause goto %question% :REP_KO cls color 0C echo. echo NO, that’s not the right answer!!! echo. pause goto %question% 


    Bilou.
    --
    There are days you shouldn't mess with me.
    And there are days every day!
    1. Hello!!
      I find your questionnaire different from mine in terms of programming
      Look at mine

      rem disables the display of commands
      echo off
      rem clears the screen
      cls
      echo Welcome to our grand quiz!!
      rem /p allows you to request the return of the variable
      set /p FIRST_NAME= Please enter your first name:
      rem clear
      cls
      rem displays the text with the entered variable
      echo Well %FIRST_NAME%, let's get started with the grand contest that might (maybe) let you win a Citroën DS3 worth €45,000
      rem stop
      pause
      echo So, first question: What is the capital of Canada?
      echo a)Pyongyang
      echo b)Ottawa
      echo c)Montreal
      echo d)Seoul
      rem /p allows you to request the return of the variable
      set /p ANSWER= Please indicate your answer (a/b/c/d):
      rem displays the text with the entered variable
      IF %ANSWER% EQU b echo Congratulations!! you found the correct answer
      IF %ANSWER% NEQ b echo Too bad!! the correct answer was Montreal not answer %ANSWER%
      rem stop
      pause
      cls
      echo Second question:
      echo When was François Hollande invested with his presidential powers?
      echo a)April 21, 2013
      echo b)May 16, 2013
      echo c)May 5, 2013
      echo d)May 15, 2013
      rem /p allows you to request the return of the variable
      set /p ANSWER= Please indicate your answer (a/b/c/d):
      rem displays the text with the entered variable
      if %ANSWER% EQU d echo Congratulations!! the correct answer was indeed answer d
      if %ANSWER% NEQ d echo Too bad!! you did not enter the correct answer. The correct answer was answer d
      rem stop
      pause
      cls
      echo I will let you prepare for the last question (the most difficult)
      rem timer
      :loop
      set /a count = count + 1
      if %count%==1000 goto endloop
      goto loop
      :endloop
      echo Third and final question:
      echo In which year did Louis-Napoleon Bonaparte (Napoleon III) die
      echo a) in 1870
      echo b) in 1873
      echo c) in 1865
      echo d) in 1885
      rem /p allows you to request the return of the variable
      set /p ANSWER= Enter your answer here (a/b/c/d):
      rem displays the text with the entered variable
      if %ANSWER% EQU b echo Bravissimo!!!!!! You entered the correct answer !!
      if %ANSWER% NEQ b echo Too bad, but it was still hard! the correct answer was answer b and not %ANSWER%
      rem stop
      pause
      cls
      color 2c
      echo THANK YOU FOR PARTICIPATING IN THE GRAND CONTEST !!!!
      rem /p allows you to request the return of the variable
      set /p ANSWER= Did you enjoy this quiz?
      rem displays the text with the entered variable
      if %ANSWER% EQU yes echo You won the DS3 car !!!! CONGRATULATIONS!!!
      if %ANSWER% EQU no echo You didn't win the DS3 car !!! TOO BAD!!! you should have answered yes !!
      if %ANSWER% EQU maybe echo That's quite typical of Samuel LEGER !!!! Or someone who has no opinion on things (like Samuel LEGER)
      if %ANSWER% EQU yes and no echo That's quite typical of Samuel LEGER !!!! Or someone who has no opinion on things (like Samuel LEGER)
      rem stop
      pause
      cls
      color 2a
      echo Now, you can exit by pressing ENTER
      pause
      cls



      Stephane
      1. Hello everyone, thanks cs bilou,
        but there is an error in my batch, can you correct it for me please?
        1. Hello to you.
          Not bad your batch questionnaire.
          Especially if you're just starting out.
          So here's mine:

          @echo off title Questionnaire set note=5 :question1 cls color 0F echo. ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo ºQuestion 1: What is the extension of batch files?º ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ echo 1: ".bat" echo 2: ".batch" echo 3: ".dos" echo 4: ".ms-dos" set /p REP1=Your answer (number): if "%REP1%"=="1" (goto rep_bon) else goto rep_fausse :question2 cls color 0F echo. ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo ºQuestion 2: What is the command to delete a file?º ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍΙÍÍÍÍÍÍÍÍÍÍͼ echo 1: "ECHO" echo 2: "CD" echo 3: "DEL" echo 4: "DIR" ECHO **************** set /p REP2=Your answer (number): if "%REP2%"=="3" (goto rep_bon) else goto rep_fausse :question3 cls color 0F echo. ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ» echo ºQuestion 3: What is the command to change the audio volume?º ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍͼ echo 1: "MODE" echo 2: "VOL" echo 3: "RD" echo 4: "Can't do it" set /p REP3=Your answer (number): if "%REP3%"=="4" (goto rep_bon) else goto rep_fausse :question4 cls color 0F echo. ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÉÍÍÍÍÍÍÍÍͼ echo ºQuestion 4: What is the command to display the contents of a folder?º ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÉÍÍÍÍÍÍÍÍÍÍÉÍÍÍͼ echo 1: "ECHO" echo 2: "DIR" echo 3: "CMD" echo 4: "CLS" set /p REP4=Your answer (number): if "%REP4%"=="2" (goto rep_bon) else goto rep_fausse :question5 cls color 0F echo. ECHO ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÉÍÍÍÍͼ echo ºQuestion 5: What is the command to move files?º ECHO ÈÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÉÍÍÍÍÍÍÍÉÍÍÍͼ echo 1: "COPY" echo 2: "MODE" echo 3: "MOVE" echo 4: "MOVE" set /p REP5=Your answer (number): if "%REP5%"=="3" (goto rep_bon) else goto rep_fausse :rep_bon cls color 02 echo CONGRATULATIONS, that is the correct answer!!! echo Next Question. pause if "%REP1%"=="1" ( set REP1=0 goto question2 ) if "%REP2%"=="3" ( set REP2=0 goto question3 ) if "%REP3%"=="4" ( set REP3=0 goto question4 ) if "%REP4%"=="2" ( set REP4=0 goto question5 ) if "%REP5%"=="3" ( set REP5=0 goto score ) :rep_fausse cls color 0C echo No, that's not it!! set /a note-=1 pause if not "%REP1%"=="0" goto question1 if not "%REP2%"=="0" goto question2 if not "%REP3%"=="0" goto question3 if not "%REP4%"=="0" goto question4 if not "%REP5%"=="0" goto question5 :score cls color 0E echo Your score is %note%/5 pause


          Bilou.
          --
          There are days when you shouldn't mess with me.
          And there are days every day!
          1. Je voudrais créer un questionnaire (je suis débutant) mais serait-il possible de poser une question et, en fonction de la réponse (oui ou non), de changer le contenu ?

            Ex :
            Ça vous plaît ??? Oui
            Alors, commençons

            Ex : Ça vous plaît ??? Non
            Bon, eh bien le questionnaire se termine ici

            Voilà, merci de me répondre à l'adresse : lucbrugeron@gmail.com
            Merci d'avance

            f4h3p
          2. Je voudrais créer un questionnaire (je suis débutant) mais serait-il possible de poser une question et en fonction de la réponse, que ça change ????

            ex :
            Ça vous plaît ??? oui
            alors commençons

            ex : Ça vous plaît ??? non
            bon, le questionnaire se termine

            Voilà, merci de me répondre à l'adresse : lucbrugeron@gmail.com
            Merci par avance

            f4h3p