根据Powershell的说法,我有一个Elasticsearch的安装工作已经好几个月了但是莫名其妙地失踪了。我最近唯一能想到的就是我更新了Java。
当我尝试使用完整路径运行它时,我收到以下错误:
connect by
路径存在且没有拼写错误,您可以在此处看到:
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
我对处理Powershell错误没有很强的了解,所以我只尝试了一些事情:
这些都没有改变任何东西。
这是elasticsearch.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.
答案 0 :(得分:1)
PS C:\> C:\elasticsearch\bin\elasticsearch.bat
The system cannot find the path specified.
您确定批处理文件的输出吗?换句话说,批处理文件中的某些内容无法找到指定的路径(可能是java.exe
)。如果PowerShell无法找到该文件,您将收到类似第二次尝试的错误消息。
说到你的第二次尝试:
PS C:\elasticsearch\bin> elasticsearch.bat
正如错误消息所述,这对当前文件夹中的文件不起作用。您需要明确指定当前文件夹:
PS C:\elasticsearch\bin> .\elasticsearch.bat