how to take input in batch code example

Example 1: get user input batch

rem rem is a comment line, NOT CODE, however it is a real batch command
rem The below line of code will ask the user a question.
rem Then, the input will be stored in a variable.
rem in this case, the variable is favcolor.

set /P favcolor="What is your favorite color?"

rem optional line of code to make use of the variable.

echo Wow, I like the color %favcolor% too!

Example 2: batch input variable

set /p Input=Enter some text:

Tags:

Misc Example