0

This is one of the more obscure Windows batch errors I've received.

In a batch file (first and only line of code):

CALL IF "%1"=="" (ECHO TRUE) ELSE (ECHO false)

returns

',' is not recognized as an internal or external command, 
    operable program or batch file

I realize that this is not the best way to call an if statement, but does anybody know what the interpreter is trying to do?

By the way, this works from the command prompt as well, and what the if is testing seems to be irrelevant. Whatever is happening seems to by invoked by CALL IF

dgo
  • 3,877
  • 5
  • 34
  • 47
  • 1
    Type `CALL /?` at a command prompt. You're using it totally inappropriately, and any error you get as a result is meaningless. – Ken White Apr 01 '15 at 18:13
  • 1
    Why would you want to "CALL" an `IF` statement? Why not just say `IF "%1" ==...` without the `CALL`? – lurker Apr 01 '15 at 18:17
  • I feel like this is one of the few times I can get away with saying this on SO, but the best way to avoid this error is to not do that. – SomethingDark Apr 01 '15 at 18:23
  • It was an accident that I did this. But I still want to know why what get's produced get's produced. – dgo Apr 01 '15 at 19:53

1 Answers1

1

the issue has been discussed here: Why I can't CALL "IF" and "FOR" neither in batch nor in the cmd?

Its because of CALL and IF parsers (especially IF which has few phases) , but as we have no the command prompt source we can't know why exactly this happens.

Community
  • 1
  • 1
npocmaka
  • 55,367
  • 18
  • 148
  • 187