Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望能够在 Windows 环境中使用 cmd 管道将 URL 传递给 curl,所以它会是这样的:
echo "google.com" | curl
这应该发出以下命令:
curl "google.com"
似乎有点琐碎。
默认情况下curl从命令行读取 URL,而不是从标准输入流中读取。
curl
您需要请求curl使用配置文件,然后指明该文件是标准输入流(-用作文件名)。另请注意,配置文件中的 URL(管道或非管道)需要--url前缀。
-
--url
所以,在你的情况下
echo --url "google.com" | curl --config -