(I'll use this script as an example)
@echo off
:start
cls
set /p x=enter the password:
if %x%==1 goto correct
echo incorrect
timeout 1 >nul /nobreak
goto start
:correct
echo correct
timeout 2 >nul /nobreak
goto start
If I just press enter, without any input, it tells me correct. Why? how can I prevent this? Is my syntax incorrect?
Also, If I press space, then enter, the batch file quits. It tells me in that split second screen the error (something like):
Goto was unexpected at this time
Which leads me to believe that I didn't give an instance/define the [space] key, but I cut out the spaces in the first instance. Wouldn't this mean that everything that didn't match the specific criteria
if %x%==1 goto correct
would just continue on in the script, since it's value didn't meet the one described in the given instance?