‘The syntax of the command is incorrect.’ while firing elasticsearch.bat for the first time

Recently I wanted to run ElasticSearch (here I wrote how to do it) on the fresh copy of Windows. So, I downloaded the package, typed

in CMD and I got this error:

If you also get this ‘meaningful’ message someday, check if you have java installed. If not, well, that’s the best moment to do so!


‘I installed java, the error still occurs!’

Slow down! Now, you need to close the CMD window. Then reopen it and inside the console, go to the ‘bin’ catalog of your ElasticSearch package and type elasticsearch.bat again. It will do :).


Featured image by Steven Welch


Share this:

  • This might be pretty common for those who don’t develop with Java on their machine. I had similar problem during elasticsearch setup and it took some time to find the right JRE or SDK with proper bitness 😉

    Luckily when that setup part is gone, elasticsearch seems an amazing tool.