Newbie in Batch File System?

SherwinRoy

New member
Joined
Nov 11, 2010
Messages
6
Reaction score
0
Points
1
please help me about this batch file system, i'm just newbie in this kind of thing.

how to do this one:

if you'll type 1, it will display "yes"
if you'll type 2, it will display "no"
if you'll type 3, it will display "maybe"
or else, it will display "invalid input".

please help me about this. thanks!

P.S. this is in line about MS-DOS
 
Batch files you cannot get user inputs like enter your password:_____
I Presume, that you are asking about supplying a commaind line parameter as argument to a batch file. Here it is.

REM This will display the messages
if %1==1 then echo yes
goto end
if %1==2 then echo no
goto end
if %1==3 then echo maybe
goto end
echo invalid input
end:
eho Game over
 
@echo off
:start
set /p char=Type number from 1 to 3 and press Enter:
if %char%==1 (echo Yes & goto wait)
if %char%==2 (echo no & goto wait)
if %char%==3 (echo maybe & goto wait)
:invalid
echo invalid input
:wait
pause
goto start
 
Back
Top