Page 1 of 1

Menu to sub menu selection

Posted: 23 Sep 2012 02:53
by Mahendra
i am able to create a menu for selection of items. The menu items created based on the output of the command and output may not be same always. i want to select the items from that menu.

@echo off
setlocal enabledelayedexpansion

set c=0
for /f "tokens=2 delims=' '" %%m in ('runmqakm -cert -list all -db abc.db -pw passwd') do (
set /a c=c+1
echo !c!.%%m
)
set /p input= enter your input :

The output will be like this

1. test1
2. test2 cert
3. versign cert
4.
5.
enter your input :

The user can select 0-100(any) ,...suppose the user select option 2. The associate value test2 cert as label for another command to execute
for /f "tokens=2 delims=' '" %%m in ('runmqakm -cert -details -%label% -db abc.db -pw passwd') do echo %%m

i am unable to catch associated option value to execute another command. can some one guide me on this.?

Re: Menu to sub menu selection

Posted: 23 Sep 2012 03:20
by foxidrive
Here is one way.

Code: Select all

@echo off
setlocal enabledelayedexpansion
set c=0
for /f "tokens=2 delims=' '" %%m in ('runmqakm -cert -list all -db abc.db -pw passwd') do (
set /a c=c+1
set [!c!]=%%m
)
set [
set /p input= enter your input :
echo ![%input%]!
pause