在Windows 10上安装Curl命令

时间:2020-07-27 12:59:55  来源:igfitidea点击:

curl命令行实用程序安装在大多数UNIX中,如操作系统,包括Linux和Mac OS。
但是,默认情况下,Microsoft Windows上不可用Curl命令。

要获取Windows 10的curl,我们将使用Git Bash Shell,为Windows提供有用的UNIX命令行工具。
这是在Windows 10上安装Curl的最简单方法。

首先,到了URL https://git-scm.com/downloads并下载最新版本的Windows。

下载完成后,运行Git安装程序并使用默认选项安装Git。

安装完成后,从Windows 10开始菜单打开Git Bash。
在git bash shell类型:

curl --help

这将打印我们可以在Windows Curl命令中使用的所有不同命令行选项。

Windows Curl命令示例

访问URL并将数据转储到shell:

curl https://example.com

访问URL并将数据保存到输出文件。

curl https://example.com -o example.html

下载zip文件。

curl https://example.com/example.zip -O

从FTP服务器下载文件:

curl -u username:password ftp://192.168.1.100/file1.txt -O

将文件上传到FTP服务器:

curl -u username:password -T file1.txt ftp://192.168.1.100/