spaces in an if statement
Posted: 07 Mar 2018 23:51
I am currently writing a script which asks you to type in multiple words and then checks if they were correct. I know you can put them in "" , but if you do it like this:
You have to put the answer in "" when typing as well. If you don't, it crashes. Does anyone have a solution?
Code: Select all
@echo off
:loop
echo Type "hello world".
set /p input=
if %input%=="hello world" goto helloworld
echo Error.
pause >nul
goto loop
:helloworld
echo Hi!
pause >nul
goto loop