-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?

Community
  • 1
  • 1
Basj
  • 41,386
  • 99
  • 383
  • 673
  • 1
    Ever considered to use [`choice`](http://ss64.com/nt/choice.html) for your task? – aschipfl Dec 02 '16 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. – Squashman Dec 02 '16 at 17:13
  • See [this answer](http://stackoverflow.com/a/34118487/3074564) 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. – Mofi Dec 02 '16 at 17:31

1 Answers1

3

The parenthesis must be on the same line as the if

Magoo
  • 77,302
  • 8
  • 62
  • 84