且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在64位Windows上运行cURL

更新时间:2022-12-07 12:03:40

您的问题是您没有使用安装的 Curl ,但是一个CmdLet名为 Invoke-WebRequest



只要执行:

 item别名:curl 

再次测试您的curl,然后将其存储在您的个人资料中。



解释是它在 Invoke-WebRequest 中存在一个本机别名,它是一个CmdLet,应该传递种类的 curl服务。


I'm new to cURL, just got it installed but it seems to only do what it feels like. 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. Opening a new Powershell window I'm able to use a simple GET request like so:

curl http://localhost:3000

but if I run a 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."

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."

As I mentioned, I'm a cURL newbie but it seems strange that it can do get requests but nothing else. Any ideas what I'm doing wrong?

Windows 7 64 bit Powershell version 4

Your problem is that your are not using the Curl you installed but a CmdLet called Invoke-WebRequest.

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.