I'm trying to create a batch file which asks a user a question with multiple (four) options. The options that the user chooses should trigger the batch file to ignore one of the four options.
Lets say that the commands that I would normally want to run is ECHO "A", ECHO "B", ECHO "C", ECHO "D". If the person puts A in, I would want them to still run all the other commands except ECHO "A".
Currently the solution i have come up with is the following
@echo off
set /p choice="Do you want not to do: A, B, C or D? [A/B/C/D] " [A/B/C/D]
if %choice%==A (
ECHO "B"
ECHO "C"
ECHO "D"
EXIT /b
) else if %choice%==B (
ECHO "A"
ECHO "C"
ECHO "D"
EXIT /b
) else if %choice%==C (
ECHO "A"
ECHO "B"
ECHO "D"
EXIT /b
) else if %choice%==D (
ECHO "A"
ECHO "B"
ECHO "C"
EXIT /b
) ELSE (
ECHO Please select A, B, C or D!
EXIT /b
)
However as you can imagine, i am using the echo commands as an example/abstraction. The actual commands are longer. It seems more efficient to define the commands under A, B, C and D once and then tell the batch file not to doA, B, C or D depending the users choice.
Maybe it's because I started working early today but I cannot think of an easier way to do this right now. So I hope to hear your ideas on how to make this batch script less clogged up.