problem in batch script read user input
- by JCH
hi,
i use set /p below to read user input
it seems to work outside the if block but the one inside if block doesn't work.
When i run the script second time the user input in the if block prints the previous user input.
test script:
@echo off
set cond=true
echo %cond%
if %cond%==true (
echo "cond is true"
REM the below input doesn't work
set /p name1="enter your name"
echo name is: %name1%
)
REM it works here
set /p name2="enter your name"
echo name is: %name2%
thank you