- Thread Author
- #1
In a batch file I have a line such as:
if "%1" == "some_value" goto somegoto
in order to test a parameter against a value. If however I need to pass as the first parameter to my batch file a string with some equal signs in it such as:
"cxxflags=-std=c++11"
I pass it with quotes so it is a single parameter, else batch file processing will split it on the various equal signs in the parameter. However when it processes this single batch parameter in my statement above I get the message:
=-std=c++11"" was unexpected at this time on the line in the batch file of:
if ""cxxflags=-std=c++11"" == "some_value" goto somegoto
How can I get the batch file to make the comparison correctly ? It obviously doesn't like the form of comparison of:
if "%1" == "some_string"
when %1 is itself a quoted string with an equal sign in it.
if "%1" == "some_value" goto somegoto
in order to test a parameter against a value. If however I need to pass as the first parameter to my batch file a string with some equal signs in it such as:
"cxxflags=-std=c++11"
I pass it with quotes so it is a single parameter, else batch file processing will split it on the various equal signs in the parameter. However when it processes this single batch parameter in my statement above I get the message:
=-std=c++11"" was unexpected at this time on the line in the batch file of:
if ""cxxflags=-std=c++11"" == "some_value" goto somegoto
How can I get the batch file to make the comparison correctly ? It obviously doesn't like the form of comparison of:
if "%1" == "some_string"
when %1 is itself a quoted string with an equal sign in it.