user3265987
user3265987

Reputation:

Batch- If statement not working

My code is this:

set /p input = "Enter the number here: "

if %input%==1 goto New
if %input%==2 goto Load
if %input%==3 exit

The program crashes whenever you try to input one of the numbers. It says "was expected at this time"

Upvotes: 0

Views: 30

Answers (1)

Stephan
Stephan

Reputation: 56155

you don't have a parameter %input%. But you have a parameter named %input<space>%

Write your set command without spaces:

set variable=value

for example:

set /p "input=Enter  the number here: "

Upvotes: 1

Related Questions