Ric*_*hez 164
首先,您需要下载cURL可执行文件.对于Windows 64位,下载它从这里和Windows支持32位的下载从这里
之后,保存curl.exe您的文件C:驱动器.
要使用它,只需打开command prompt并输入:
C:\curl http://someurl.com
Run Code Online (Sandbox Code Playgroud)
BRo*_*ers 137
如果你已经Git安装在Windows上,你可以使用GNU Bash它内置的....
https://superuser.com/questions/134685/run-curl-commands-from-windows-console/#483964
mat*_*tty 40
那些不需要curl可执行文件的人,而只需要一次又一次地查看或保存GET请求的结果,可以powershell直接使用.从正常的命令提示符处,键入:
powershell -Command "(new-object net.webclient).DownloadString('http://example.com')"
Run Code Online (Sandbox Code Playgroud)
虽然有点罗嗦,但与打字类似
curl http://example.com/
Run Code Online (Sandbox Code Playgroud)
在更加Unix的环境中.
有关更多信息,net.webclient请访问:WebClient方法(System.Net).
更新:我喜欢ImranHafeez在这个答案中更进了一步.我更喜欢更简单的cmd脚本,但是,可能会创建一个curl.cmd包含以下内容的文件:
@powershell -Command "(new-object net.webclient).DownloadString('%1')"
Run Code Online (Sandbox Code Playgroud)
可以像上面的Unix-ish示例一样调用它:
curl http://example.com/
Run Code Online (Sandbox Code Playgroud)
Hel*_*len 24
如果使用Chocolatey包管理器,则可以通过从命令行或从PowerShell运行此命令来安装cURL:
choco install curl
Run Code Online (Sandbox Code Playgroud)
小智 10
在Windows中创建批处理文件,并在Windows中使用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
Run Code Online (Sandbox Code Playgroud)
curl.exe并.crt以C:\Windows\System32> curl https://api.stackexchange.comps如果您希望另一个文件夹存储可执行文件检查您的路径 > echo %PATH%
小智 6
如果你要从http://curl.haxx.se/dlwiz/?type=bin&os=Win64&flav=MinGW64 - 64BIT Win7/XP或者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
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
747738 次 |
| 最近记录: |