Windows CMD/Powershell:命令不能与cURL一起使用。赛文工厂
我正试图让本教程在CMD和Windows Powershell(Windows 7 64)中运行: 第一个命令在CMD中已不起作用:Windows CMD/Powershell:命令不能与cURL一起使用。赛文工厂,windows,powershell,curl,cmd,cygwin,Windows,Powershell,Curl,Cmd,Cygwin,我正试图让本教程在CMD和Windows Powershell(Windows 7 64)中运行: 第一个命令在CMD中已不起作用: curl -XPUT 'http://localhost:9200/blog/user/dilbert' -d '{ "name" : "Dilbert Brown" }' 我收到以下错误消息: curl: (1) Protocol 'http not supported or disabled in libcurl curl: (6) Could not re
curl -XPUT 'http://localhost:9200/blog/user/dilbert' -d '{ "name" : "Dilbert Brown" }'
我收到以下错误消息:
curl: (1) Protocol 'http not supported or disabled in libcurl
curl: (6) Could not resolve host: name
curl: (7) Failed to connect to port 80: Connection refused
curl: (6) Could not resolve host: Dilbert Brown
curl: (3) [globbing] unmatched close brace/bracket in column 1
在Windows Powershell中,我得到:
{"error":"MapperParsingException[failed to parse]; nested: JsonParseException[Unrecognized token 'Dilbert': was expecting ('true', 'false' or 'null')\n at [Source: [B@132b73b; line: 1, column: 33]]; ","status":400}curl: (3) [globbing] unmatched close brace/bracket in column 7
在Cygwin中,相同的命令可以正常工作。我必须如何编写命令才能使其在CMD和Windows Powershell中工作?在Powershell中,从解析的角度来看,命令的调用是正确的 在cmd.exe中,单引号无效。您需要使用双引号来包围值
curl -XPUT "http://localhost:9200/blog/user/dilbert" -d "{ \"name\" : \"Dilbert Brown\" }"
谢谢我现在正在使用Chrome插件“Sense”。它使使用ElasticSearch比在命令行中使用cURL容易得多。