I wrote the following .bat script
@echo off
@rem set variables
set CURRENT_DIR=%cd%
set SCRIPT_DIR=%~dp0%
set Program Files=%Program Files:Program Files=Progra~1%
:input
set INPUT=
echo Following are the installation choices you have:
echo 1. Choice1
echo 2. Choice2
echo 3. Choice3
set /P INPUT=Please select any of the above choice (1to 3) : %=%
echo input is %INPUT%
if "%INPUT%"=="" goto input
if "%INPUT%"=="1" (
echo Choice 1 selected
goto QUITNOW
)
if "%INPUT%"=="2" (
echo Choice 2 selected
set /p INPUT_1=Please enter input 1: %=%
echo input_1 is %INPUT_1%
goto QUITNOW
)
if "%INPUT%"=="3" (
echo Choice 3 selected
set /p input_3= Please enter input_3: %=%
echo %input_3%
)
:QUITNOW
cd %CURRENT_DIR%
@echo on
At first when it ask me to select the choice and i entered 2,it set the INPUT variable to 2 and it goes in second if block. In if block again it ask for the input (INPUT_1),i do enter the input word but looks like this time its not setting the INPUT_1 variable.Do anyone have any idea where am i doing wrong. Following the the output of the script with my inputs
C:\Documents and Settings\Administrator\Desktop>scriptA.bat
Following are the installation choices you have:
1. Choice1
2. Choice2
3. Choice3
Please select any of the above choice (1to 3) : 2
input is 2
Choice 2 selected
Please enter input 1: failingHere
input_1 is
C:\Documents and Settings\Administrator\Desktop>
So if you observe its not printing the "failingHere" input. Please help and let me know if you need any further information regarding this.