简体   繁体   English

在 64 位 Windows 上运行 cURL

[英]Running cURL on 64 bit Windows

I'm new to cURL, just got it installed but it seems to only do what it feels like.我是 cURL 的新手,刚安装它,但它似乎只能按照感觉行事。 I'm using the 64 bit version I got from here: http://curl.haxx.se/latest.cgi?curl=win64-ssl-sspi with installation instructions I found here: http://guides.instructure.com/m/4214/l/83393-how-do-i-install-and-use-curl-on-a-windows-machine .我使用的是从这里获得的 64 位版本: http://curl.haxx.se/latest.cgi?curl=win64-ssl-sspi以及我在这里找到的安装说明: http://guides.instructure.com /m/4214/l/83393-how-do-i-install-and-use-curl-on-a-windows-machine Opening a new Powershell window I'm able to use a simple GET request like so:打开一个新的 Powershell window 我可以像这样使用一个简单的 GET 请求:

curl http://localhost:3000

but if I run a POST但是如果我运行一个 POST

curl -d "hello world" http://localhost:3000

it tells me "Invoke-WebRequest: Parameter cannot be processed because the parameter name 'd' is ambiguous. Possible matches include: -DisableKeepAlive -Debug."它告诉我“Invoke-WebRequest:无法处理参数,因为参数名称‘d’不明确。可能的匹配项包括:-DisableKeepAlive -Debug。”

Trying to get help I type试图获得帮助我打字

curl -h or curl --help

gives me "Invoke-WebRequest: Missing an argument for parameter 'Headers'. Specify a parameter of type 'System.Collections.IDictionary' and try again."给我“Invoke-WebRequest:缺少参数'Headers'的参数。指定'System.Collections.IDictionary'类型的参数并重试。”

As I mentioned, I'm a cURL newbie but it seems strange that it can do get requests but nothing else.正如我所提到的,我是一个 cURL 新手,但奇怪的是它可以获取请求但没有别的。 Any ideas what I'm doing wrong?任何想法我做错了什么?

Windows 7 64 bit Powershell version 4 Windows 7 64 位 Powershell 版本 4

Your problem is that your are not using the Curl you installed but a CmdLet called Invoke-WebRequest .您的问题是您没有使用安装的Curl ,而是使用名为Invoke-WebRequest的 CmdLet 。

Just execute :只需执行:

Remove-item alias:curl

And test your curl again, then store it in your profile.并再次测试您的卷曲,然后将其存储在您的个人资料中。

The explanation is that it exists a native alias to the Invoke-WebRequest which is a CmdLet that is supposed to deliver a kind of curl service.解释是它存在Invoke-WebRequest的本机别名,它是一个 CmdLet,应该提供一种curl 服务。


From Windows 10 build 17063 and later (April 2018), Curl is included into Windows, so that you can execute it directly from Cmd.exe or PowerShell.exe.从 Windows 10 build 17063 及更高版本(2018 年 4 月)开始, Curl包含在 Windows 中,因此您可以直接从 Cmd.exe 或 PowerShell.exe 执行它。 To use it in PowerShell be careful to unalias this CmdLet or explicitly call curl.exe.要在 PowerShell 中使用它,请小心取消此 CmdLet 的别名或显式调用 curl.exe。

Built with Schannel (Microsoft's native TLS engine), libcurl still perform peer certificate verification, but instead of using a CA cert bundle, it uses the certificates that are built into the OS.使用 Schannel(微软的原生 TLS 引擎)构建,libcurl 仍然执行对等证书验证,但它不使用 CA 证书包,而是使用操作系统中内置的证书。

You can execute curl commands with Command Prompt instead of Windows Powershell .您可以使用命令提示符而不是Windows Powershell执行 curl 命令。 Command prompt doesn't alias curl commands like Windows Powershell does.命令提示符不像 Windows Powershell 那样给 curl 命令起别名。

To open command prompt, hit Win + R , type cmd in the input box, <Enter> .要打开命令提示符,请按Win + R ,在输入框中键入cmd <Enter>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM