有没有办法在Windows中安装cURL,以便从命令提示符运行cURL命令?


当前回答

如果你在windows上安装了Git,你可以使用GNU Bash....它是内置的。

https://superuser.com/questions/134685/run-curl-commands-from-windows-console/#483964

其他回答

在Windows命令提示符中,通过Git Bash运行curl

"C:\\Users\\sizu\\AppData\\Local\\Programs\\Git\\bin\\sh.exe" --login -i -c "curl https://www.google.com"

如果你在windows上安装了Git,你可以使用GNU Bash....它是内置的。

https://superuser.com/questions/134685/run-curl-commands-from-windows-console/#483964

目前在Windows 10 build 17063及更高版本中,cURL默认随窗口一起提供。然后你不需要下载它,只需要使用curl.exe。

如果您不喜欢Cygwin,您可以使用本地Windows构建。有些在这里:curl下载向导。

更新:Curl现在包含在Windows中,不需要通过PowerShell运行它。

那些不需要curl可执行文件,而只是偶尔需要查看或保存GET请求结果的人,可以直接使用powershell。在普通的命令提示符中输入:

powershell -Command "(new-object net.webclient).DownloadString('http://example.com')"

虽然有点啰嗦,但与打字类似

curl http://example.com/

在更像unix的环境中。

更多关于网络的信息。webclient可以在这里使用:webclient Methods (System.Net)。

更新:我喜欢ImranHafeez在这个回答中更进一步的做法。我更喜欢一个简单的cmd脚本,但是,也许创建一个卷曲。包含这个的CMD文件:

@powershell -Command "(new-object net.webclient).DownloadString('%1')"

可以像上面的unix示例那样调用:

curl http://example.com/