有没有办法在Windows中安装cURL,以便从命令提示符运行cURL命令?
当前回答
目前在Windows 10 build 17063及更高版本中,cURL默认随窗口一起提供。然后你不需要下载它,只需要使用curl.exe。
其他回答
在窗口中创建批处理文件,并在窗口中享受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://cygwin.com/install.html下载cygwin的.exe文件(一个大型GNU和开源工具集合,其功能类似于Windows上的Linux发行版)。
运行.exe文件。
在安装时,您将在一个步骤中选择软件包。在选择包窗口——>中,将视图更改为“Not installed”并搜索curl。单击需要安装的包,单击包的“new”列—>,您可以看到版本号,然后单击下一步。(见下图)
安装完成后,单击cygwin打开窗口上的curl控制台并使用curl命令。
如果您下载它,它应该工作得很好 ——http://curl.haxx.se/dlwiz/?type=bin&os=Win64&flav=MinGW64——FOR 64BIT Win7/XP或from http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000%2FXP——FOR 32BIT Win7/XP只需将文件解压到c:/Windows并从cmd中运行
C:\Users\WaQas>curl -v google.com
* About to connect() to google.com port 80 (#0)
* Trying 173.194.35.105...
* connected
* Connected to google.com (173.194.35.105) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.28.1
> Host: google.com
> Accept: */*
>
* HTTP 1.0, assume close after body
< HTTP/1.0 301 Moved Permanently
< Location: http://www.google.com/
< Content-Type: text/html; charset=UTF-8
< Date: Tue, 05 Feb 2013 00:50:57 GMT
< Expires: Thu, 07 Mar 2013 00:50:57 GMT
< Cache-Control: public, max-age=2592000
< Server: gws
< Content-Length: 219
< X-XSS-Protection: 1; mode=block
< X-Frame-Options: SAMEORIGIN
< X-Cache: MISS from LHR-CacheMARA3
< X-Cache-Lookup: HIT from LHR-CacheMARA3:64003
< Connection: close
<
<HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
<TITLE>301 Moved</TITLE></HEAD><BODY>
<H1>301 Moved</H1>
The document has moved
<A HREF="http://www.google.com/">here</A>.
</BODY></HTML>
* Closing connection #0
安装Git for windows 然后使用git bash运行curl命令。
对于任何寻找快速解决方案的人,在标准安装cygwin后,但发现curl在win10 x64平台上无法工作:
下载这个退役的存储库,提取它并运行:
git-cmd.bat
效果很好。我假设它有curl的预安装选项。
推荐文章
- 如何从终端/命令行调用VS代码编辑器
- 在Jar文件中运行类
- 我如何找到哪个程序正在使用端口80在Windows?
- 在Windows中有像GREP这样的模式匹配实用程序吗?
- 如何在Windows命令提示符下运行.sh ?
- 如何在PHP中捕获cURL错误
- 如何从命令行通过mysql运行一个查询?
- 如何从命令行在windows中找到mysql数据目录
- 如何从命令行安装cygwin组件?
- 如何更改Git日志日期格式
- 在没有事件源注册的情况下写入Windows应用程序事件日志
- 无法在Windows上从/usr/local/ssl/openssl.cnf加载配置信息
- 使iTerm以与其他操作系统相同的方式翻译“元键”
- GIT克隆在windows中跨本地文件系统回购
- 如何合并2 JSON对象从2个文件使用jq?