1.

Solve : Need help with a bat menu?

Answer»

I am new to this, and saw there are some batch menu's.

The thing was it just had a menu and no function to it.

I was hoping to see if someone can help me with a menu using a bat file.

Menu
1. Select A
2. Select B
3. Select C
4. Select D
5. EXIT

Then after clicking an option...It would bring up ANOTHER menu on what you'd like to do to it. ie: copy, zip, delete, etc...


Like I said, I am new to this and would appreciate anyones help.


   -Thx in advanceLike I always say:
"USE GOOGLE BEFORE POSTING!"
try this.

Code: [Select]echo off
cls
:menu
echo This is a Batch Menu
echo ==============
echo [1] Option One
echo [2] Option Two
echo [3] Option Three
echo.
set /p choice=1, 2, or 3?
if 'choice'=='1' goto one
if 'choice'=='2' goto two
if 'choice'=='3' goto three
goto menu

:one
<your code here>

:two
<your code here>

:three
<your code here>

that is a simple menu but you can add on more options.thank you for the template of the menu.
I was working off another template but was GIVING me issues.
For some reason, I cannot get the exit command to work with this one.

I'm still in the process of coding things, but do you know if I select an option that isn't there, it will return or make me choose a selection on the screen?

Thank you for your help.

This is what I have so far:


echo off
cls
:menu
echo Select Option
echo ==============
echo [1] July 4th Banner
echo [2] Flash Drive Banner
echo [3] Christmas Banner
echo [4] New Years Banner
echo [Q] Exit/Quite
echo.
set /p choice=
echo.
if 'choice'=='1' goto one
if 'choice'=='2' goto two
if 'choice'=='3' goto three
if 'choice'=='4' goto four
if 'choice'=='Q' goto exit
goto menu

   :one
   echo off
   cls
   :menu
   echo Select Option For July 4th Banner
   echo ==================================
   echo [5] Copy
   echo [6] Paste
   echo [7] Zip
   echo [8] Execute batch file
   echo

  • Main Menu

   echo.
   set /p choice=
   if 'choice'=='5' goto five
   if 'choice'=='6' goto six
   if 'choice'=='7' goto seven
   if 'choice'=='8' goto eight
   if 'choice'=='0' goto zero
   echo.
   goto menu

      :five
      

      :six
      

      :seven
      

      :eight
      

      :zero
      goto menu


         :two
         echo off
         cls
         :menu
         echo Select Option For Flash Drive Banner
         echo ====================================
         echo [9] Copy
         echo [10] Paste
         echo [11] Zip
         echo [12] Execute batch file
         echo
  • Main Menu

         echo.
         set /p choice=
         if 'choice'=='9' goto nine
         if 'choice'=='10' goto ten
         if 'choice'=='11' goto eleven
         if 'choice'=='12' goto twelve
         if 'choice'=='0' goto zero
         echo.
         goto menu

            :nine
            

            :ten
            

            :eleven
            

            :twelve
            

            :zero
            goto menu


                  :three
                  echo off
                  cls
                  :menu
                  echo Select Option For Christmas Banner
                  echo ==================================
                  echo [13] Copy
                  echo [14] Paste
                  echo [15] Zip
                  echo [16] Execute batch file
                  echo
  • Main Menu

                  echo.
                  set /p choice=
                  if 'choice'=='13' goto thirteen
                  if 'choice'=='14' goto fourteen
                  if 'choice'=='15' goto fifteen
                  if 'choice'=='16' goto SIXTEEN
                  if 'choice'=='0' goto zero
                  echo.
                  goto menu

                     :thirteen
                     

                     :fourteen
                     

                     :fifteen
                     

                     :sixteen
                     

                     :zero
                     goto menu

                           :four
                           echo off
                           cls
                           :menu
                           echo Select Option For New Years Banner
                           echo ==================================
                           echo [17] Copy
                           echo [18] Paste
                           echo [19] Zip
                           echo [20] Execute batch file
                           echo
  • Main Menu

                           echo.
                           set /p choice=
                           if 'choice'=='17' goto seventeen
                           if 'choice'=='18' goto eighteen
                           if 'choice'=='19' goto nineteen
                           if 'choice'=='20' goto twenty
                           if 'choice'=='0' goto zero
                           echo.
                           goto menu

                              :seventeen
                              

                              :eighteen
                              

                              :nineteen
                              

                              :twenty
                              

                              :zero
      goto menu

                                       :exit                        exit Quote from: ontheroad on July 31, 2008, 11:02:49 AM
For some reason, I cannot get the exit command to work with this one.
                                       :exit                        exit

You must not have anything else on a label line apart from the label.hmm...i tried what you wrote and it still won't exit.


thx thowhy not do
Code: [Select]if 'choice'=='Q' exit?
Quote
hmm...i tried what you wrote and it still won't exit.
you wrote
Code: [Select]:exit
exitand it does not work ?

EDIT:
try that signs for menus
Code: [Select]echo.ÉÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍ
echo.ş
echo.ş
echo.ČÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍÍI tried your "if choice" and it did not work for me.

:exit
exit

^that did not work for me either...

I do not understand why.

I do appreciate you guys trying to help...i'm just stuck try Code: [Select]if /I '%choice%' equ 'Q' exitwhat os you have ?You aren't using variables properly. Clue: what is this? %YES, that worked.

Thank you for taking your time and assisting me.

Greatly appreciate it. Quote from: Dias de verano on July 31, 2008, 12:14:21 PM
You aren't using variables properly. Clue: what is this? %

My bad  Quote from: macdad- on July 31, 2008, 03:45:55 PM
Quote from: Dias de verano on July 31, 2008, 12:14:21 PM
You aren't using variables properly. Clue: what is this? %

My bad 

I am surprised at you, macdad. With a SIG like yours as well.  ok ok. i just missed the %s and went with it. and yes i  think that its a bit to over done(my sig)


Discussion

No Comment Found