1

I am trying to use spaces in the following command

if /I %clubeligaNOS% == Rio Ave goto Rio Ave

but if I write Rio Ave, instead of going to :Rio Ave it closes the program, it works if I just use Rio. If anyone knows how to use spaces in this please help

(I've already tried quotes "")

Screenshot

enter image description here

Magoo
  • 77,302
  • 8
  • 62
  • 84
  • 3
    You cannot have a label with spaces so change `:Rio Ave` to `:RioAve`, and your command should be, `if /I "%clubeligaNOS%" == "Rio Ave" goto RioAve`. That assumes you have not omitted any other important information, and that everything else in your script up to that point is correct. – Compo Aug 26 '19 at 23:28
  • I recommend reading my answer on [Symbol equivalent to NEQ, LSS, GTR, etc. in Windows batch files](https://stackoverflow.com/a/47386323/3074564) which explains very detailed how to do a __string__ comparison with command __IF__ in a batch file. – Mofi Aug 27 '19 at 08:41

1 Answers1

-1

Instead of using if /I %clubeligaNOS% == Rio Ave goto Rio Ave use if /I %clubeligaNOS% == "Rio Ave" goto x the reason being batch (most languages) doesn't like spaces in variable/function names so if you put quotes it says that is one thing instead of 2

IsaacWP121
  • 111
  • 1
  • 10
  • 1
    ImaGonnaDie, please check out my comment below the question itself, to see the correct syntax and proper advice for solving the issue. – Compo Aug 27 '19 at 01:47