Open In App

Batch Script – Input / Output

In this article, we are going to learn how to take input from users using Batch Script.

Taking User Input:

@echo off
echo Batch Script to take input.
set /p input= Type any input
echo Input is: %input%
pause

Explanation :

set /p input= Type any input
echo Input is : %input%

Input Code :

code for taking user input

Execution of the above code :

1. After saving the above code with .bat format. When we will run the file, the below cmd screen will be shown.



After running the file

2. In the next step we will provide any input, as shown.

Giving input as Geeks For Geeks

3. After pressing enter we will get user input data as Output, as shown in the below image.



Final Output is displayed

Article Tags :