Windows的cURL:如何在控制台中发送多行命令? [英] cURL for Windows: how can I send multiple line command in a console?

查看:529
本文介绍了Windows的cURL:如何在控制台中发送多行命令?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习使用cURL,我需要在控制台中运行它:

I am learning to use cURL and I need to run this in a console:

curl -XGET localhost:9200/library/book/_search?pretty=true -d {
    "query" : {
        "query_string" : { "query" : "title:crime" }
    }
}

但这是多行命令.如何处理它以发送完整的命令?

But this is a multi-line command. How can I handle it to send a complete command?

请注意,我知道我可以将-d之后的内容放在文件中以运行此命令.

Note that I understand I can put the content after -d in a file to run this command.

推荐答案

到目前为止,我还没有找到在Windows上使用curl发送跨多个命令的任何方法.但是,我能够找到一种方法来完成任务.下面是我如何重写您要实现的命令

I didn't find any way so far to send command spanning multiple using curl on windows. However, I was able to find a way to get the task done. Below is how I would rewrite the command you are trying to achieve

curl -XGET localhost:9200/library/book/_search?pretty=true -d "{ \"query\" : { \"query_string\" : { \"query\" : \"title:crime\" }  } }"

只需确保/library/book/是正确的索引名称.

Just make sure the /library/book/ is right index name.

希望能听到回音

这篇关于Windows的cURL:如何在控制台中发送多行命令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆