Jump to content

The new Choice command


Recommended Posts

Hi,

I would like to create a menu with 7 choices in a batch file. I used to use the choice option but in XP sp2 it seems is not available as standard. I do not want to use any 3rd part apps II just want to use standard windows commands.

Can anyone of you smart guys help ?

Hail hail

Link to comment
Share on other sites


SET /P variable=[promptstring]

See help for SET command.

The /P switch allows you to set the value of a variable to a line of input

entered by the user. Displays the specified promptString before reading

the line of input. The promptString can be empty.

Link to comment
Share on other sites

prathapml :

Here is the menu, it works well for me just now

hail hail

@echo off

:START

CLS

color f2

echo.

echo.  1 - SlipStream SP2

echo.  2 - Apply Hotfixes

echo.  3 - Make Unattended

echo.  4 - Add Registry Etires

echo.  5 - Create ISO

echo.  6 - The Works

echo.

echo.  0 - EXIT

echo.

echo. && set /p MO=Choose your option?

if /i "%MO%"=="6" (

goto 6

)

if /i "%MO%"=="5" (

goto 5

)

if /i "%MO%"=="4" (

goto 4

)

if /i "%MO%"=="3" (

goto 3

)

if /i "%MO%"=="2" (

goto 2

)

if /i "%MO%"=="1" (

goto 1

)

if "%MO%"=="0" goto 0

) else if  /i "%MO%"=="" ( echo. CHOOSE AGAIN (

CLS

echo.

echo. Your selection was invalid. Please try again.

echo.

pause

goto START

)

PAUSE

:6

CLS

echo OPTION %MO% taken

Pause

GOTO FIN

:5

CLS

echo OPTION %MO% taken

Pause

GOTO FIN

:4

CLS

echo OPTION %MO% taken

Pause

GOTO FIN

:3

CLS

echo OPTION %MO% taken

Pause

GOTO FIN

:2

CLS

echo OPTION %MO% taken

Pause

GOTO FIN

:1

CLS

echo OPTION %MO% taken

Pause

GOTO FIN

:0a

echo. OPTION %MO% taken.  EXIT the batch

Pause

GOTO FIN

:FIN

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...