2010-04-26 02:09:21 +0000 2010-04-26 02:09:21 +0000
86
86
Advertisement

从windows控制台运行cURL命令

Advertisement

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

Advertisement

答案 (9)

92
92
92
2012-10-05 18:25:26 +0000

如果你安装了Git for Windows,你也会自动得到Curl。有一些好处:

  • Git 在安装过程中会自动处理 PATH 的设置。
  • 你会得到 GNU bash ,一个非常强大的 shell,在我看来,它比 Windows 原生的控制台要好很多。
74
74
74
2010-04-26 02:19:40 +0000

&004

然后把它放在你的PATH环境变量里面的目录下(即:C:\Windows\System32),或者在可执行文件名前面加上它的完整路径。

3
Advertisement
3
3
2011-04-09 03:08:40 +0000

安装好OpenSSL Light后,重启Windows,打开命令提示符,然后做一个测试命令,如:

curl http://www.google.com

,如果你找回了HTML标签,就成功了。

3
3
3
2013-02-28 20:31:16 +0000

如何设置cURL:

  • 下载并解压64位的cURL。
  • 下载并安装Visual Studio 2010 C++ Runtime Redistributable 64位 这里.
  • 将此文件从curl.exe重命名为PATH
  • 将此文件移到你的Windows C:\Windows\System32文件夹中。

如何测试:

  • 运行cacert.pem打开命令提示符。如果你看到了这个,cURL就可以运行了!
3
Advertisement
3
3
2016-03-05 18:33:27 +0000

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

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

,虽然有点拗口,但与在Unix环境中输入

curl http://example.com/

类似。WebClient方法(System.Net)](https://msdn.microsoft.com/en-us/library/system.net.webclient_methods(v=vs.110).aspx)。

2
2
2
2018-01-19 10:51:56 +0000

从Insider Build 17063中开始,Tar和Curl作为Windows工具链的一部分,在Windows上可用: curl和bsdtar。一个命令行工具,允许用户提取文件和创建存档。在PowerShell或安装第三方软件之外,没有办法从cmd.exe中提取文件。本实现使用libarchive。

Curl*。

注意:PowerShell已经提供了类似的功能(它有curl和自己的文件提取工具)。

1
Advertisement
1
1
2013-11-21 21:32:15 +0000

你可以安装这个 “cURL for Windows":cURL for Windows是一个MSI的安装程序,用于cURL,流行的命令行网络传输工具http://www.confusedbycode.com/curl/

0
0
0
2015-01-02 20:51:02 +0000

不需要重启windows,但是重启CMD是必要的。 1. 从[curl.haxx.se]安装cURL。根据 curl.exe 的位置设置路径环境变量,像 C:Users\YoucURL 3. 從 mozilla.org 下載證書檔案,並把它移到 system32 資料夾。

0
Advertisement
0
0
2018-06-07 14:30:27 +0000

我使用fuxia提供的答案,在Windows平台上运行了一些我在Linux中编写的bash脚本。

有一点要注意的是cURL。我遇到了一个问题,在验证时不能使用Console交互,就像这里描述的那样。https://stackoverflow.com/questions/50724407/curl-command-in-git-bash

如果你的cURL命令需要验证,而你不想让密码在命令行中显示或存储在你的脚本中,你必须使用另一个解决方案,比如使用密码文件 https://stackoverflow.com/questions/2594880/using-curl-with-a-username-and-password

Advertisement