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. Click Start>Run
  2. Advertisement
  3. After each press enter. Anything in parenthesis do NOT type, these are side-notes that tries to explain the steps.
  4. cls (This will clear anything above - optional but recommended if you're wanting to make it look neat)
    start
  5. )
  6. )
  7. ~0,1%
  8. Then type:)
  9. Please try again.
  10. choice1
  11. end
  12. 29
    Save this as a .bat file. Double click to test your batch file.
  13. Advertisement


Community Q&A

Search
Add New Question
  • Question
    True or false: you can open Notepad using run options?
    Felix Vincent
    Community Answer
    True, type in notepad or notepad.exe. Also, you can use CMD for that with "start Notepad."
Ask a Question
      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

      Thanks to all authors for creating a page that has been read 251,418 times.

      Is this article up to date?

      Advertisement