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


当前回答

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

其他回答

在窗口中创建批处理文件,并在窗口中享受cURL:)

@echo off
echo You are about to use windows cURL, Enter your url after curl command below:
set /p input="curl "
cls
echo %input%
powershell -Command "(new-object net.webclient).DownloadString('%input%')"
pause

访问下载页面https://curl.haxx.se/download.html -这是不可思议的 在列表中选择您的系统 别忘了SSL支持,现在很明显了,比如https 将curl.exe和.crt解压到C:\Windows\System32目录下 重启cmd 享受>卷曲https://api.stackexchange.com

p.s.如果您想要另一个文件夹存储可执行文件,请检查您的路径> echo %PATH%

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

从这里安装git命令行。当你在windows中安装git时,你会自动得到curl。您可以使用curl—version检查已安装的curl版本。

这是一个示例curl请求,它发送一个JSON对象中的字符串并对其进行编码。

卷曲https://api.base62.io/encode \ ——请求POST \ ——header "Content-Type: application/json" \ ——data '{"data": "Hello world!"} '

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

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