HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

choice — Prompt user to select a choice and return the selected choice index. More information: <https://lear

Submitted by: @import:tldr-pages··
0
Viewed 0 times
selectpromptcommandandcliuserchoice
windows

Problem

How to use the choice command: Prompt user to select a choice and return the selected choice index. More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/choice>.

Solution

choice — Prompt user to select a choice and return the selected choice index. More information: <https://learn.microsoft.com/windows-server/administration/windows-commands/choice>.

Prompt the current user to select a Y or N choice:
choice


Prompt the current user to select a [c]hoice from a specific set:
choice /c {{AB}}


Prompt the current user to select a choice with a specific [m]essage:
choice /m "{{message}}"


Prompt the current user to select a [c]ase-[s]ensitive [c]hoice from a specific set:
choice /cs /c {{Ab}}


Prompt the current user to select a choice and prefer the [d]efault choice in a specific [t]ime:
choice /t {{5}} /d {{default_choice}}


Display help:
choice /?

Code Snippets

Prompt the current user to select a `Y` or `N` choice

choice

Prompt the current user to select a [c]hoice from a specific set

choice /c {{AB}}

Prompt the current user to select a choice with a specific [m]essage

choice /m "{{message}}"

Prompt the current user to select a [c]ase-[s]ensitive [c]hoice from a specific set

choice /cs /c {{Ab}}

Prompt the current user to select a choice and prefer the [d]efault choice in a specific [t]ime

choice /t {{5}} /d {{default_choice}}

Context

tldr-pages: windows/choice

Revisions (0)

No revisions yet.