我有一個Elasticsearch的安裝,它可以正常工作好幾個月,但根據Powershell已經莫名其妙地失蹤了。我能想到的唯一事情最近已經改變了,那就是我更新了Java。系統找不到在Powershell中找不到路徑/命令錯誤
當我嘗試使用完整路徑,我得到了以下錯誤來運行它:
PS C:\> C:\elasticsearch\bin\elasticsearch.bat
The system cannot find the path specified.
的路徑存在和不存在拼寫錯誤,你可以在這裏看到:
PS C:\elasticsearch\bin> dir
Directory: C:\elasticsearch\bin
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 8/7/2016 10:13 PM 5551 elasticsearch
-a---- 8/7/2016 10:13 PM 104448 elasticsearch-service-mgr.exe
-a---- 8/7/2016 10:13 PM 103936 elasticsearch-service-x64.exe
-a---- 8/7/2016 10:13 PM 80896 elasticsearch-service-x86.exe
-a---- 8/7/2016 10:13 PM 909 elasticsearch.bat
-a---- 8/7/2016 10:13 PM 3307 elasticsearch.in.bat
-a---- 8/7/2016 10:13 PM 2814 elasticsearch.in.sh
-a---- 8/7/2016 10:13 PM 2992 plugin
-a---- 8/7/2016 10:13 PM 1303 plugin.bat
-a---- 8/7/2016 10:13 PM 6501 service.bat
當我嘗試從目錄本身運行它,我得到以下消息:
PS C:\elasticsearch\bin> elasticsearch.bat
elasticsearch.bat : The term 'elasticsearch.bat' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:1 char:1
+ elasticsearch.bat
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (elasticsearch.bat:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Suggestion [3,General]: The command elasticsearch.bat was not found, but does exist in the current location. Windows Pow
erShell does not load commands from the current location by default. If you trust this command, instead type: ".\elastic
search.bat". See "get-help about_Command_Precedence" for more details.
我不'噸有處理PowerShell的錯誤,一個強大的知識,所以我只試了幾件事情:
- 重新安裝Elasticsearch
- 添加含有elasticsearch.bat的路徑
- 運行elasticsearch.bat使用命令的目錄./elasticsearch.bat
這些都不會改變任何東西。
這裏的elasticsearch.bat的內容:
@echo off
SETLOCAL enabledelayedexpansion
TITLE Elasticsearch 2.3.5
SET params='%*'
:loop
FOR /F "usebackq tokens=1* delims= " %%A IN (!params!) DO (
SET current=%%A
SET params='%%B'
SET silent=N
IF "!current!" == "-s" (
SET silent=Y
)
IF "!current!" == "--silent" (
SET silent=Y
)
IF "!silent!" == "Y" (
SET nopauseonerror=Y
) ELSE (
IF "x!newparams!" NEQ "x" (
SET newparams=!newparams! !current!
) ELSE (
SET newparams=!current!
)
)
IF "x!params!" NEQ "x" (
GOTO loop
)
)
SET HOSTNAME=%COMPUTERNAME%
CALL "%~dp0elasticsearch.in.bat"
IF ERRORLEVEL 1 (
IF NOT DEFINED nopauseonerror (
PAUSE
)
EXIT /B %ERRORLEVEL%
)
"%JAVA_HOME%\bin\java" %JAVA_OPTS% %ES_JAVA_OPTS% %ES_PARAMS% -cp "%ES_CLASSPATH%" "org.elasticsearch.bootstrap.Elasticsearch" start !newparams!
ENDLOCAL
咳嗽讀取錯誤消息「*建議[3,常規]:命令elasticsearch.bat沒有被發現,但在目前的位置確實存在的Windows PowerShell不會。如果您信任此命令,請輸入:「。\ elastic search.bat」。有關更多詳細信息,請參閱「get-help about_Command_Precedence」。* *不知道爲什麼第一個沒有工作,可能是批處理文件中的某些東西引用了已經移動的java.exe?什麼是批處理文件? – TessellatingHeckler
我確實嘗試了錯誤信息中的建議,即從bin目錄運行。\ elasticsearch.bat,我得到的只是「系統找不到指定的路徑」。我將發佈上面的.bat文件的內容。給我一點時間。 – Atlas