PDF download Download Article PDF download Download Article

Are you really good at programming Batch Files, but you just don't know how to make those yes or no Choices or Menus that list Choices 1, 2, and 3? Well you've come to the correct place!

  1. Advertisement
  2. After each press enter. Anything in parenthesis do NOT type, these are side-notes that tries to explain the steps.
  3. )
  4. )
  5. ~0,1%
  6. Then type:)
  7. Please try again.
  8. 29
    Save this as a .bat file. Double click to test your batch file.
  9. Advertisement


Community Q&A

Search
Add New Question
  • Question
    True or false: you can open Notepad using run options?
    Felix Vincent
    Felix Vincent
    Community Answer
    True, type in notepad or notepad.exe. Also, you can use CMD for that with "start Notepad."
Ask a Question
200 characters left
Include your email address to get a message when this question is answered.
Submit
Advertisement

Example

@ECHO off
cls
:start
ECHO.
ECHO 1. Print Hello
ECHO 2. Print Bye
ECHO 3. Print Test
set /p choice=Type the number to print text.
rem if not '%choice%'=='' set choice=%choice:~0;1% ( don`t use this command, because it takes only first digit in the case you type more digits. After that for example choice 23455666 is choice 2 and you get "bye"
if '%choice%'=='' ECHO "%choice%" is not valid please try again
if '%choice%'=='1' goto hello
if '%choice%'=='2' goto bye
if '%choice%'=='3' goto test
ECHO.
goto start
:hello
ECHO HELLO
goto end
:bye
ECHO BYE
goto end
:test
ECHO TEST
goto end
:end
pause
exit

Tips

Show More Tips
Submit a Tip
All tip submissions are carefully reviewed before being published
Name
Please provide your name and last initial
Thanks for submitting a tip for review!
Advertisement

Warnings

Advertisement

About This Article

Tested by:
wikiHow Technology Team
wikiHow is a “wiki,” similar to Wikipedia, which means that many of our articles are co-written by multiple authors. To create this article, 13 people, some anonymous, worked to edit and improve it over time. This article has been viewed 252,889 times.
How helpful is this?
Co-authors: 13
Updated: July 11, 2022
Views: 252,889
Categories: Programming
Thanks to all authors for creating a page that has been read 252,889 times.

Is this article up to date?

Advertisement