1

I have a batch file that is throwing a syntax error at a particular line.

@ECHO ON
CD %~dp0
SET XDA_HOME_DIR=%CD:~0,-4%
SET "JAVAHOME=%JAVA_HOME%"
SET XDA_CONFIG_PROPERTIES=%XDA_HOME_DIR%\config\xda-config.properties
IF "%JAVAHOME%"== ""( 
ECHO JAVA_HOME not set
GOTO END)

Note: This is not the full script. I have posted just a part of it.

Below is the error thrown: enter image description here

What is causing the syntax error message?

1 Answer 1

2

error comes from here:

IF "%JAVAHOME%"== ""( 
ECHO JAVA_HOME not set
GOTO END)

you need a space before the opening bracket:

IF "%JAVAHOME%" == "" ( 
  ECHO JAVA_HOME not set
  GOTO END
)
Sign up to request clarification or add additional context in comments.

3 Comments

thanks , it worked , however i see another error, "C:\Softwares\xCP\XDA_win64\xDA\bin>IF "C:\Program Files\Java\jdk1.7.0_10;" == "" ( ECHO JAVA_HOME not set GOTO END ) set was unexpected at this time.
Please edit code and error messages into the question. It is difficult in comments.
there are was ";" in the path , when i removed it worked , thanks for the help

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.