# X-pack\\..\\elasticsearch-env.bat"' is not recognized as an internal or external command

**URL:** https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641
**Category:** Elasticsearch
**Created:** [December 7, 2017, 9:36am UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641 "2017-12-07T09:36:16Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![mrba](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mrba](https://discuss.elastic.co/u/mrba)
#### Post date: [December 7, 2017, 9:36am UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/1 "2017-12-07T09:36:17Z")

</div>

Hello everyone,

I am trying to install the x\_pack on elasticsearch i've followed every instructions in this [guide](https://www.elastic.co/guide/en/elasticsearch/reference/6.0/installing-xpack-es.html)  
I set up the elasticsearch.yml file as it says , I restart elasticsearch and in one line I get this:

[2017-12-07T09:36:35,987][ERROR][o.e.x.m.c.i.IndexStatsCollector] [9njwqLj] collector [index-stats] failed to collect data  
org.elasticsearch.cluster.block.ClusterBlockException: blocked by: [SERVICE\_UNAVAILABLE/1/state not recovered / initialized];  
at org.elasticsearch.cluster.block.ClusterBlocks.globalBlockedException(ClusterBlocks.java:165) ~[elasticsearch-6.0.0.jar:6.0.0]  
"it repeats the same mistake (at org.elasticsearch.something) until "

[2017-12-07T09:36:38,091][INFO][o.e.l.LicenseService] [9njwqLj] license [2b51a185-1182-4c86-a424-91ef909b99d9] mode [trial] - valid  
[2017-12-07T09:36:38,129][INFO][o.e.g.GatewayService] [9njwqLj] recovered [7] indices into cluster\_state  
[2017-12-07T09:36:47,981][INFO][o.e.c.m.MetaDataCreateIndexService] [9njwqLj] [.monitoring-es-6-2017.12.07] creating index, cause [auto(bulk api)], templates [.monitoring-es], shards [1]/[1], mappings [doc]  
[2017-12-07T09:36:51,285][INFO][o.e.c.r.a.AllocationService] [9njwqLj] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[my-index][3], [.kibana][0], [.monitoring-es-6-2017.12.07][0]] ...]).  
[2017-12-07T09:37:51,523][INFO][o.e.c.m.MetaDataCreateIndexService] [9njwqLj] [.watcher-history-6-2017.12.07] creating index, cause [auto(bulk api)], templates [.watch-history-6], shards [1]/[1], mappings [doc]  
[2017-12-07T09:37:52,697][INFO][o.e.c.m.MetaDataMappingService] [9njwqLj] [.watcher-history-6-2017.12.07/Hlt05ZPKQcqWWAXIJKJ9Xg] update\_mapping [doc]  
[2017-12-07T09:37:53,071][INFO][o.e.c.m.MetaDataMappingService] [9njwqLj] [.watcher-history-6-2017.12.07/Hlt05ZPKQcqWWAXIJKJ9Xg] update\_mapping [doc]

And it stop right there, So i continued to the next step , and execute this command:

\bin\x-pack\>setup-passwords interactive

And i get this :

'"C:\Program Files\Elastic\Elasticsearch\6.0.0\bin\x-pack..\elasticsearch-env.bat"' is not recognized as an internal or external command, operable program or batch file.

In an other topic it says that the x-pach-env.bat was missing but I checked and it's there.

Could you help me please

Best Regards

Reda

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [December 7, 2017, 12:12pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/2 "2017-12-07T12:12:58Z")

</div>

Hello,

Are you running this on windows?

If so, you need to run setup-passwords.bat instead of setup-passwords.

---

<div class="post-metadata">

### Author: ![mrba](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mrba](https://discuss.elastic.co/u/mrba)
#### Post date: [December 7, 2017, 12:58pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/3 "2017-12-07T12:58:18Z")

</div>

yes I am on windows , i have the same results "C:\Program Files\Elastic\Elasticsearch\6.0.0\bin\x-pack..\elasticsearch-env.bat"' n’est pas reconnu en tant que commande interne  
ou externe, un programme exécutable ou un fichier de commandes.

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [December 7, 2017, 1:02pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/4 "2017-12-07T13:02:44Z")

</div>

Can you paste the content of your `setup-passwords.bat` here?

---

<div class="post-metadata">

### Author: ![mrba](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mrba](https://discuss.elastic.co/u/mrba)
#### Post date: [December 7, 2017, 1:20pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/5 "2017-12-07T13:20:50Z")

</div>

@echo off

setlocal enabledelayedexpansion  
setlocal enableextensions

call "%~dp0..\elasticsearch-env.bat" || exit /b 1

call "%~dp0x-pack-env.bat" || exit /b 1

%JAVA% ^  
%ES\_JAVA\_OPTS% ^  
-Des.path.home="%ES\_HOME%" ^  
-Des.path.conf="%ES\_PATH\_CONF%" ^  
-cp "%ES\_CLASSPATH%" ^  
org.elasticsearch.xpack.security.authc.esnative.tool.SetupPasswordTool ^  
%\*

endlocal  
endlocal

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [December 7, 2017, 1:36pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/6 "2017-12-07T13:36:04Z")

</div>

Everything looks good in there, it's the same as mine that works. Did you install Elasticsearch via the MSI package?

---

<div class="post-metadata">

### Author: ![mrba](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mrba](https://discuss.elastic.co/u/mrba)
#### Post date: [December 7, 2017, 1:41pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/7 "2017-12-07T13:41:34Z")

</div>

No when i tried to install via the msi package it returns an error occured so i installed it with the zip file

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [December 7, 2017, 1:49pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/8 "2017-12-07T13:49:36Z")

</div>

I'm trying to reproduce that error locally now. In the meantime, can you confirm that you followed the same steps that I usually do:

1. From the bin folder of elasticsearch I run: `elasticsearch-plugin.bat install x-pack`
2. After that is done, i start Elasticsearch (from elasticsearch.bat in the case of the zip version)
3. From the bin\x-pack folder I run `setup-passwords.bat interactive`

After this it should work just fine. And it shouldn't matter if you do it from Cmd or Powershell.

---

<div class="post-metadata">

### Author: ![mrba](https://avatars.discourse-cdn.com/v4/letter/m/a183cd/32.png) [@mrba](https://discuss.elastic.co/u/mrba)
#### Post date: [December 7, 2017, 1:57pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/9 "2017-12-07T13:57:02Z")

</div>

So i install x-pack on elasticsearch and kibana with this command elasticsearch-plugin.bat install x-pack the same with kibana kibana-plugin.bat install x-pack

then i generate certificate certgen command i save it into the config directory  
then i modified the elasticsearch.yml and add those line :  
xpack.ssl.key: certs/${[node.name](http://node.name)}/${[node.name](http://node.name)}.key (path to my certificate)  
xpack.ssl.certificate: certs/${[node.name](http://node.name)}/${[node.name](http://node.name)}.crt  
xpack.ssl.certificate\_authorities: certs/ca/ca.crt  
xpack.security.transport.ssl.enabled: true

after that i restarted elasticsearch end execute the setup\_passwords command

---

<div class="post-metadata">

### Author: ![Marius\_Dragomir](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/marius_dragomir/32/42087_2.png) [@Marius\_Dragomir](https://discuss.elastic.co/u/Marius_Dragomir)
#### Post date: [December 7, 2017, 3:13pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/10 "2017-12-07T15:13:41Z")

</div>

I can't manage to reproduce this issue locally. Can you give more details on it?  
I tried with 6.0.1 and Windows Server 2012 and Windows 10, with both the MSI and the zip package.

Can you also make sure that elasticsearch-env.bat is present in the `bin` folder of Elasticsearch?  
If you unzip Elasticsearch again in a new place and do the steps that I mentioned, does it work?

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [January 4, 2018, 3:14pm UTC](https://discuss.elastic.co/t/x-pack-elasticsearch-env-bat-is-not-recognized-as-an-internal-or-external-command/110641/11 "2018-01-04T15:14:03Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
