-1

This doesn't work ("incorrect syntax error"):

@ECHO OFF

SET /p type="[1] 32bit    [2] 64bit    [3] 32+64bit: "

if %type% == 1
(
  REM Do something here
  REM Do something here
)

I thought it was correct, according to the question How to use if - else structure in a batch file?

What's wrong?

3
  • 1
    Ever considered to use choice for your task? Commented Dec 2, 2016 at 17:06
  • Your example does not follow the same syntax as the example in the link you posted as Magoo has pointed out to you in his answer. Commented Dec 2, 2016 at 17:13
  • See this answer with a brief description of IF syntax. Running in a command prompt window if /? explains this command and the syntax which must be used as well. Commented Dec 2, 2016 at 17:31

1 Answer 1

3

The parenthesis must be on the same line as the if

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.