Web Analytics

Batch-Files are small yet powerful tools that you can create to easy your daily chores. Back in the day when Windows was glass covered holes for letting air and light into your house, Batch scripting was an essential and every day tasks. Today, most people don’t even know it exists.

This time we’ll explore how to create a multiple choice menu that can trigger files, website and functions.

Create a multiple choice menu in a batch-file

There are endless possibilities to this, so what I’m about to show you will only cover a few bases that will point you in the direction you might want to go.

First up a few definitions

  • Goto: The Goto Statement allows us to jump to a specific part of the script, like back to Start or the end.
  • [Place]: When we use the Goto Statement we need a target. The Target or Place is defined by a Colon and a name (:HOME).
  • Variables (or Var): Variables are small post-it notes that stores information (user input) for later use. In Batch Scripting we declare a variable with the SET command.
  • ECHO: This Command is used to hide or show feedback to the user. Turning it OFF will make sure everything we do is invisible to the user.
  • CLS: Clear Screen, empties the CMD-window
  • Pause: Inserting the PAUSE command will pause the script from running until the user press a key.
  • START or CALL: Commands used to trigger an event (a batch file, website etc)
  • Exit: This command ends the script from running

Onto the Script

This script will do many things (to show you it’s possible). Under normal circumstances  you would create separate scripts for different functionality or tasks.

Open Notepad and enter the following code:

@echo off
title Multiple Choice Menu
echo Select a task:
echo =============
echo 1) Open www.mintywhite.com
echo 2) List Temp-files
echo 3) Run IpConfig.exe
echo 4) Run CleanUp.Bat
echo 5) Exit
set /p web=Type option:
if "%web%"=="1" start www.mintywhite.com
if "%web%"=="2" goto list
if "%web%"=="3" start ipconfig.exe
if "%web%"=="4" Call cleanup.bat
if "%web%"=="5" exit
goto home
echo Listing files from c:\windows\temp
dir c:\windows\temp /p /b
goto home

Save the document as Menu.bat
Then Create another bat-file, call it cleanup.bat and save it in the same folder as the above.
Copy this code into it:

echo Removing Temp-files from c:\windows\temp
echo Note! If you get an error, you need to run
echo this with administrative privileges.
Del *.tmp /Q

That’s all

Good luck to you. Should you have any questions about this, don’t hesitate to contact me here on in the Forum.

About Thomas

Computer geek from the age of 7, which amounts to 30 years of computer experience. From the early days (when every computer company had their own OS) of DOS, Windows 1.0 through Seven...

Free PC tips by email

Search Windows Guides


13 thoughts on “Create Multiple Choice Menu in a Batch-File [How To]”

  1. Steve says:

    Thomas, I think you will find that the “choice” command is much better suited to a menu with single-character choices. It has built-in smarts that limit the answers that are allowed and it easily converts the user’s choices to errorlevel values which can make multi-level logic easy to do. Here’s a version of your “script”:
    @echo off
    title Multiple Choice Menu
    echo. && echo.
    echo ~~~~~~ Select a Task ~~~~~~
    echo M – Open http://www.mintywhite.com
    echo L – List User Temp-files
    echo I – Display IpConfig Info
    echo C – Run CleanUp.Bat
    echo X – Exit
    choice /C mlicx /N /T 60 /D x /M “Select a Task from the list (M, L, I, C or X): ”
    if errorlevel 005 echo. && echo. && goto :EOF
    if errorlevel 004 start “Cleanup Utility” Cleanup.bat && goto :HOME
    if errorlevel 003 goto :IPCONFIG
    if errorlevel 002 start “Listing of %USERNAME%’s files from %TEMP%…” dir /o:g %TEMP% && goto :HOME
    if errorlevel 001 start http://www.mintywhite.com && goto :HOME

    cls && echo. && echo.
    %SystemRoot%System32ipconfig.exe /all
    echo. && echo Hit any key to return to menu… && echo. && pause >nul
    goto :HOME

    It also contains a couple of neat tricks that non-newbies might find interesting.

    Also, I caution you on using “.bat” vs “.cmd” extensions. Under certain circumstances, the two file-types behave differently. “.cmd” is the best to use in the NT environment (Win2K and beyond). Here’s an example – newbies, stop reading at this point lest you get a headach:

    @echo off
    call :LABEL && echo This is a .CMD File || echo This is a .BAT File
    goto :EOF

    md 2>nul
    set var=1
    Save this file as a .BAT and as a .CMD and run each.

    1. Anonymous says:

      Thank you for your input.
      The goal with my original script was to write it as simple as possible.
      Making it understandable to the newbies.
      But as a non-newbie your approach is definetively more secure.

    2. Anonymous says:

      Some stupid update from Windows in some cases makes it impossible to use the choice command anymore…
      I have no idea which update it was, but I noticed it on several computers at work.
      Too bad, because I liked that one very much. Now I allways use the set command which seems to work out fine any time.

  2. Hitsvaidya21 says:

    Hey frenz how to make a batch program which opens photoes instead of application.


    echo 1. Notepad
    echo 2. Calculator
    echo 3. Microsoft Word
    echo 4. Windows Media Player
    echo 5. Google Chrome
    echo 6. Internet Explorer
    echo 7. I’m Done
    set /p x=Pick:
    IF ‘%x%’ == ‘%x%’ GOTO Item_%x%

    GOTO Start
    d of programs i want to open photoes. Is it possible? how?

    1. Orkus2 says:

      Yes – just do “start (filename).(file extension).”

  3. Anonymous says:

    good but how i can make it automaticly run 2 or more choice


    1. Thomas says:

      The easiest way would be to create a separate BATCH file with all the files or programs you would like to run and make the menu start the second batch file.
      See the #4 choice in my original script.

  4. Juliana Cristy Damasco says:

    I love these little tweaks you walk us through step-by-step!  Thank You!

  5. Aaditya says:

    After executing item 1,can we again come back to our menu??

    1. Stu says:

      You could hack a for loop together but goto is much easier. Something like this maybe:

      :MENUecho What shall we do?echo  1) command_1echo  2) command_2echo  3) command_3choice /c:123 /n /m “Choose an option: “if errorlevel 3 ( command_3 && goto:MENU )if errorlevel 2 (        command_2 && goto:MENU )if errorlevel 1 ( command_1 && goto:MENU )

  6. hawk says:

    What if you want to make it so you just PRESS the character, instead of hving to type it in

  7. shivabeach says:

    I well remember if you could type copy con autoexec.bat and actually make it do something like open a program when you booted the computer you were a programming genius in your company.

  8. ibmwasuser says:


Comments are closed.

Computer tips in your inbox
Sign up for the Windows Guides newsletter to get PC tips and access to free Windows books (More details)

Subscribe now
Popular Guides

See which sites have been visited on your PC (even if private browsing mode is used)

Create a Windows 7 System Repair Disc

Best Free Anti-malware

Hibernate vs. Sleep vs. Shut-Down

i3, i5, and i7; Dual, Quad, Hexa Core Processors. How to they Differ?

Intel's Ivy Bridge Processor: new Features

Windows Guides on Facebook