Choice command in Batch Files

T

Thusitha

earlier with win98 I could use 'choice' command in batch
files. But with win2000 it is not available. How can I
use 'CHOICE' command in win2000 batch files ? pl. give me
an example.
 
P

Phil Robyn

Thusitha said:
earlier with win98 I could use 'choice' command in batch
files. But with win2000 it is not available. How can I
use 'CHOICE' command in win2000 batch files ? pl. give me
an example.

Have a look at other messages in this newsgroup with 'choice'
in the subject field.
 
A

Alan Tang

Thusitha said:
earlier with win98 I could use 'choice' command in batch
files. But with win2000 it is not available. How can I
use 'CHOICE' command in win2000 batch files ? pl. give me
an example.

Try to use :

SET /P TEST_VAR="Please enter the number! "
if "%TEST_VAR%"=="1" echo Your Ans=1
if "%TEST_VAR%"=="2" echo Your Ans=2
if "%TEST_VAR%"=="3" echo Your Ans=3
if /i "%TEST_VAR%"=="a" echo Your Ans=A
if /i "%TEST_VAR%"=="b" echo Your Ans=B
if /i "%TEST_VAR%"=="c" echo Your Ans=C
 
M

Mark V

Thusitha wrote in
earlier with win98 I could use 'choice' command in batch
files. But with win2000 it is not available. How can I
use 'CHOICE' command in win2000 batch files ? pl. give me
an example.

See other answers and note that it is _possible_ to use and older
CHOICE.EXE (eg NT4 Resource Kit) in W2K/XP but that running 2 or more
instances may fail. SET /P varname=
is the best built-in solution.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top