1

im currently writing a batch file and i would like to make a toggle menu for choices to execute instead of the common question and answer execution

is there any way to make a list of choices and toggle "run" or "off" for them and hit enter to start

I found a file that seemed to get me in the right direction but i dont know how to make it work with my batch file

the code i found is...

@echo off

set _on=0

:top
cls

if %_on%==0 (set _nlb= &set _nrb= &set _flb=[&set _frb=]) else (set _nlb=    [&set _nrb=]&set _flb= &set _frb= )

echo The '_on' flag is currently: %_nlb% On %_nrb%  %_flb% Off %_frb%
echo.
echo Press any key to toggle the '_on' flag
pause>nul

if %_on%==0 (set _on=1) else (set _on=0)
goto top

id like it to look like

netusers [run] [off]
netuseradministrator [run] [off]
virus.exe [run] [off]
press enter to initiate selected.

in that type of layout if that makes any sense

Blorgbeard
  • 101,031
  • 48
  • 228
  • 272
Ian Dyer
  • 11
  • 1
  • Wouldn't a list of desired options be enough for you? For example: `1. netusers` - `2. netuseradministrator` - `3. virus.exe` - `set /P "list=Enter the list of desired processes: "` – Aacini Aug 31 '15 at 00:49
  • Or the method presented in [menus in batch file](http://stackoverflow.com/questions/19125913/menus-in-batch-file). Looks like you are coding a batch file to attack computers. – Mofi Aug 31 '15 at 05:21

1 Answers1

0

use the Choice command. for example

echo 1] Settings
echo 2] Start
echo 3] Quit
choice /c 123 /n
if %errorlevel%==1 goto settings
if %errorlevel%==2 goto start
if %errorlevel%==3 goto quit

there are more parameters for timeout and stuff like that. Look at choice /?

Luke Deven
  • 66
  • 1
  • 8