@echo off color OA menu cls echo Hey! Welcome to the game! echo 1) start echo 2) how to play echo 3) Exit 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 starts 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 go back? (y/n) set /p menu if %menu% Ey goto menu if %menu% == n goto exit goto help exit echo Thanks for playing! timeout 5 exit level 1 cls echo Q1 MS DOS developed in echo 1) 1988 echo 2) 1984 echo 3) 1990 set /p answer1 = if %answer1% == 1 goto wrong1 if %answer1% == 2 goto correct1 if %answer1% == 3 goto wrong1 correct1 cls echo You are right! Next Level? (y/n) set /p NL1= if %NL1% == y goto level2 if %NL1% == n goto menu goto correct 1 wrong1 cls Echo Sadly, you were wrong Retry? (y/n) set/p WA1= if %WA1% == y goto level1 if %WA1% == n goto menu goto wrong 1 level2 cls echo Q1 which command is used to clear the screen? echo 1) Cls echo 2) Clear echo 3) Clscreen echo 4) All of above set /p aa= if %aa% 1 goto correct2 if %aa% == 2 goto wrong2 % if %aa% == 3 goto wrong2 if %aa% == 4 goto wrong2 goto correct2 a correct2 cls echo You are right! Next level? (y/n) set /p ka= if %ka% == y goto level3 if %ka% == n goto menu wrong2 cls echo Sadly, you were wrong Retry? (y/n) set/p retry= if %retry% == y goto level3 if %retry% == n goto menu :level3 cls echo Q3 internal command in dos are echo 1) cls, rd label echo 2) type ,time,dir echo 3) none of above set /p kar if %ka% 1) goto wrong3 if %ka% == 2) goto correct3 if %ka% = 3) goto wrong3 goto correct3 == == :correct3 cls echo You are correct! You won the game! goto exit :wrong3 cls echo sadly, you were wrong Retry? (y/n) set/p retry= if %retry% == y goto level3 if %retry% == n goto exit
Write, Run & Share Bash code online using OneCompiler's Online Bash Shell for free. It's one of the robust, feature-rich Bash shell available over online and getting started with the OneCompiler's Bash Shell is simple and pretty fast. The editor shows sample boilerplate code when you choose language as Bash
. OneCompiler also has reference scripts, where you can look for the sample scripts and start coding.
Bash (Bourne Again Shell) is a shell program written by Brian Fox and is an upgraded version of Bourne Shell program 'sh'.
name="Foo"
echo $name
echo "$name"
echo "${name}"
if [ conditional-expression ]
then
statements
fi
if [ conditional-expression ]
then
statements
else
statements
fi
if [ conditional-expression ]
then
statements
elif [ conditional-expression ]
then
statements
else
statements
fi