batch file help

funkymatt

Diamond Member
Jun 2, 2005
3,919
1
81
I created a batch file to install a program, when it starts it aks you what version you want to install. How do I add another selection for 3.1 wihout assigning it a whole number e.g. 5?

This is what I have now...

<choice /c:234 Press "2","3",or "4" to select the version of the ARM compiler you wish to install.

if errorlevel 3 goto arm4install
if errorlevel 2 goto arm3install
if errorlevel 1 goto arm2install
 

Ken g6

Programming Moderator, Elite Member
Moderator
Dec 11, 1999
16,836
4,815
75
You could try another prompt... (The following code is untested.)

choice /c:234 Press "2","3",or "4" to select the version of the ARM compiler you wish to install.

if errorlevel 3 goto arm4install
if errorlevel 2 goto arm3choice
if errorlevel 1 goto arm2install

:arm3choice
choice /c:01 Press "0" for ARM 3.0, or "1" for ARM 3.1
if errorlevel 2 goto arm31install
if errorlevel 1 goto arm3install
 

funkymatt

Diamond Member
Jun 2, 2005
3,919
1
81
since this is in windows, I took advantage of the environmental variables.

Echo Type the version you wish to install. Press "E" to exit.
echo Valid Choices 2.0, 2.1, 3.0, 3.1, 4.0
set /P ARMVER=
if %ARMVER%==2.0 goto arm2install
if %ARMVER%==2.1 goto arm2.1install
if %ARMVER%==3.0 goto arm3install
if %ARMVER%==3.1 goto arm3.1install
if %ARMVER%==4.0 goto arm4install
if %ARMVER%==E goto end