New
#1
String with spaces in set /p (batch file)
Hi! I would like to let a user type in things with spaces in set /p. This is the code I currently have that does not work:
This works if saynew has no spaces, but not if it does. If I type, for example, "hello people", it will briefly say "hello was not expected at this time" and then crash. What did I do wrong? I tried putting "" around %saynew%:Code::newdoc2 cls echo What do you want to say? set saynew=%randomnum% set /p saynew= if %saynew% == %randomnum% goto newdoc2 echo "%saynew%" >%namenew% goto start
but it did not work. Any ideas?Code:echo "%saynew%" >%namenew%