diff --git a/distribution/src/bin/elasticsearch-cli.bat b/distribution/src/bin/elasticsearch-cli.bat index e85abdee448..b668a7c06c2 100644 --- a/distribution/src/bin/elasticsearch-cli.bat +++ b/distribution/src/bin/elasticsearch-cli.bat @@ -6,11 +6,6 @@ if defined ES_ADDITIONAL_SOURCES ( ) ) -for /f "tokens=1*" %%a in ("%*") do ( - set main_class=%%a - set arguments=%%b -) - if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES ( for %%a in ("%ES_ADDITIONAL_CLASSPATH_DIRECTORIES:;=","%") do ( set ES_CLASSPATH=!ES_CLASSPATH!;!ES_HOME!/%%a/* @@ -24,5 +19,5 @@ if defined ES_ADDITIONAL_CLASSPATH_DIRECTORIES ( -Des.distribution.flavor="%ES_DISTRIBUTION_FLAVOR%" ^ -Des.distribution.type="%ES_DISTRIBUTION_TYPE%" ^ -cp "%ES_CLASSPATH%" ^ - %main_class% ^ - %arguments% + "%ES_MAIN_CLASS%" ^ + %* diff --git a/distribution/src/bin/elasticsearch-keystore.bat b/distribution/src/bin/elasticsearch-keystore.bat index 380a3e501d5..b43182a273f 100644 --- a/distribution/src/bin/elasticsearch-keystore.bat +++ b/distribution/src/bin/elasticsearch-keystore.bat @@ -3,8 +3,8 @@ setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.common.settings.KeyStoreCli call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.common.settings.KeyStoreCli ^ %%* ^ || exit /b 1 diff --git a/distribution/src/bin/elasticsearch-plugin.bat b/distribution/src/bin/elasticsearch-plugin.bat index 5d7b1d7a828..7e71de790f0 100644 --- a/distribution/src/bin/elasticsearch-plugin.bat +++ b/distribution/src/bin/elasticsearch-plugin.bat @@ -3,9 +3,9 @@ setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.plugins.PluginCli set ES_ADDITIONAL_CLASSPATH_DIRECTORIES=lib/tools/plugin-cli call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.plugins.PluginCli ^ %%* ^ || exit /b 1 diff --git a/distribution/src/bin/elasticsearch-translog.bat b/distribution/src/bin/elasticsearch-translog.bat index 9c4cefcf2fe..6a2e3046205 100644 --- a/distribution/src/bin/elasticsearch-translog.bat +++ b/distribution/src/bin/elasticsearch-translog.bat @@ -3,8 +3,8 @@ setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.index.translog.TranslogToolCli call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.index.translog.TranslogToolCli ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat index 01f3c0f21cd..b5842b57b16 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certgen.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.core.ssl.CertificateGenerateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.core.ssl.CertificateGenerateTool ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat index f8a5fd9880a..2e397190f23 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-certutil.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.core.ssl.CertificateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.core.ssl.CertificateTool ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat index 67faf2ea66a..4b8e4f926d7 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-migrate.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.security.authc.esnative.ESNativeRealmMigrateTool ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat index 6cdd539a81d..64a272dfbb5 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-saml-metadata.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.security.authc.saml.SamlMetadataCommand ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat index e3ea134ae43..3c956ca47ba 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-setup-passwords.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat index 570eef619ec..11414872d07 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-syskeygen.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.security.crypto.tool.SystemKeyTool ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat index 2975fbe87b9..9b35895ed86 100644 --- a/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat +++ b/x-pack/plugin/security/src/main/bin/elasticsearch-users.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.security.authc.file.tool.UsersTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-security-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.security.authc.file.tool.UsersTool ^ %%* ^ || exit /b 1 diff --git a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat index 281b06cf77b..2b4a33c9f9e 100644 --- a/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat +++ b/x-pack/plugin/watcher/src/main/bin/elasticsearch-croneval.bat @@ -7,9 +7,9 @@ rem you may not use this file except in compliance with the Elastic License. setlocal enabledelayedexpansion setlocal enableextensions +set ES_MAIN_CLASS=org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool set ES_ADDITIONAL_SOURCES=x-pack-env;x-pack-watcher-env call "%~dp0elasticsearch-cli.bat" ^ - org.elasticsearch.xpack.watcher.trigger.schedule.tool.CronEvalTool ^ %%* ^ || exit /b 1