Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows CMD/Powershell:命令不能与cURL一起使用。赛文工厂_Windows_Powershell_Curl_Cmd_Cygwin - Fatal编程技术网

Windows CMD/Powershell:命令不能与cURL一起使用。赛文工厂

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

我正试图让本教程在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 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容易得多。