Get user input from DOS prompt





0/5 (0 vote)
Not quite, CDMTJX. There are 2 problems with the alternative you posted.Previous values for uname are not cleared. Running this twice WILL see the previous valueThe logic is backwards.This will work as you intended:@ECHO OFFset uname=SET /P uname="Please enter your name: "IF...
Not quite, CDMTJX. There are 2 problems with the alternative you posted.
- Previous values for uname are not cleared. Running this twice WILL see the previous value
- The logic is backwards.
@ECHO OFF set uname= SET /P uname="Please enter your name: " IF "%uname%"=="" ( ECHO error ... ) ELSE ( ECHO Hello %uname%... )