Choice

Choice

A Windows command that allows a batch file to include multiple tasks and lets the user choose which one to perform. Choice accepts a single character as input. The syntax varies between Windows versions; however, the following three-character example works in Windows Vista, 7 and 8. See batch file abc's.
@echo off choice /c abcif errorlevel 3 goto thingcif errorlevel 2 goto thingb(do thing a here)goto end:thingb(do thing b here)goto end:thingc(do thing c here):end


The allowable characters follow the /c, and the example above prompts the user with [A, B, C]?. If any other character is entered, the computer beeps. The input character is stored as an error level: "a" becomes error level 1; "b" is 2 and "c" is 3.
Copyright © 1981-2025 by The Computer Language Company Inc. All Rights reserved. THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher.
Mentioned in
Copyright © 2003-2025 Farlex, Inc Disclaimer
All content on this website, including dictionary, thesaurus, literature, geography, and other reference data is for informational purposes only. This information should not be considered complete, up to date, and is not intended to be used in place of a visit, consultation, or advice of a legal, medical, or any other professional.