Code for BATCH FILE SHOWING THE USAGE OF CHOICE COMMAND in Dos

| 0 Comments

@echo off

CLS

REM CHOICE HELPS TO GO TO A PARTICULAR LABEL.

REM BATCH FILE STARTS..............

ECHO THIS IS BATCH FILE SHOWING THE USE OF CHOICE COMMAND.

ECHO 0.ADDITION.
ECHO 1.SUBTRACTION.
ECHO 2.MULITIPLICATION.
ECHO 3.DIVISION.
ECHO 4.EXIT

CHOICE /C1234/T:1,10 "ENTER U R CHOICE :"

IF ERRORLEVEL = 4 GOTO QUIT
IF ERRORLEVEL = 3 GOTO D
IF ERRORLEVEL = 2 GOTO M
IF ERRORLEVEL = 1 GOTO S
IF ERRORLEVEL = 0 GOTO A

:D
SET /A %ANS=2/3
ECHO %ANS%
GOTO EXIT

:M
SET /A %ANS=2*3
ECHO %ANS%
GOTO EXIT

:S
SET /A %ANS=2-3
ECHO %ANS%
GOTO EXIT

:A
SET /A %ANS=2/3
ECHO %ANS%
GOTO EXIT

:EXIT

Leave a Reply