Ejecutar comandos cURL desde la consola de Windows


¿Hay alguna forma de instalar cURL en Windows para ejecutar comandos cURL desde el símbolo del sistema?

Author: deadly, 2010-04-26

16 answers

Si no estás en Cygwin, puedes usar compilaciones nativas de Windows. Algunos están aquí: curl Download Wizard.

 436
Author: Gabriel Ščerbák,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-17 13:33:14

Primero debe descargar el ejecutable cURL. Para Windows 64bit, descargarlo desde aquí y para Windows 32bit descargar desde aquí Después de eso, guarde el archivo curl.exe en su unidad C:.

Para usarlo, simplemente abra el command prompt y escriba:

C:\curl http://someurl.com
 157
Author: Ricardo Sanchez,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-08-29 06:16:36

Si tiene Git instalado en Windows, puede usar GNU Bash.... está incorporado.

Https://superuser.com/questions/134685/run-curl-commands-from-windows-console/#483964

 126
Author: BRogers,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-03-20 10:18:19

Las personas que no necesitan literalmente el ejecutable curl, sino que solo necesitan, por ejemplo, ver o guardar los resultados de una solicitud GET de vez en cuando, pueden usar powershell directamente. Desde un símbolo del sistema normal, escriba:

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

Que, aunque un poco prolijo, es similar a escribir

curl http://example.com/

En un entorno más Unix-ish.

Más información sobre net.webclient está disponible aquí: Métodos WebClient (System.Net).

ACTUALIZACIÓN: Me gusta cómo ImranHafeez llevó este paso más allá en esta respuesta. Sin embargo, preferiría un script cmd más simple, tal vez creando un archivo curl.cmd que contenga esto:

@powershell -Command "(new-object net.webclient).DownloadString('%1')"

Que se podría llamar al igual que el ejemplo de Unix-ish anterior:

curl http://example.com/
 37
Author: matty,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-05-23 11:54:59

Si utiliza el gestor de paquetes Chocolatey , puede instalar cURL ejecutando este comando desde la línea de comandos o desde PowerShell:

choco install curl
 22
Author: Helen,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-07-16 09:01:30

Crear archivo por lotes en windows y disfrutar con cURL en windows:)

@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
 8
Author: ImranHafeez,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-04-04 13:51:47

Debería funcionar perfectamente bien si lo descargaras desde -- http://curl.haxx.se/dlwiz/?type=bin&os=Win64&flav=MinGW64 FOR PARA Win7 / XP DE 64 BITS O desde http://curl.haxx.se/dlwiz/?type=bin&os=Win32&flav=-&ver=2000%2FXP - - - PARA 32BIT Win7 / XP simplemente extraiga los archivos a c:/Windows y ejecutarlo desde 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
 6
Author: WaQas,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-02-05 00:55:13
  1. Visita la página de descarga https://curl.haxx.se/download.html - es increíble
  2. Elija su sistema en la lista
  3. No olvide el soporte SSL, ahora es obvio, por ejemplo, para https
  4. Desempaquetar curl.exe y .crt a C:\Windows\System32
  5. Reiniciar cmd
  6. Disfruta > curl https://api.stackexchange.com

P. S. Si desea otra carpeta para almacenar ejecutable compruebe sus rutas > echo %PATH%

 4
Author: vladkras,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2016-12-09 05:32:48

También he encontrado que si pongo la papelera cygwin en mi ruta de Windows puedo ejecutar curl desde una línea de comandos de Windows. También le dará acceso a cosas como ls y grep

 3
Author: kingd9,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2013-06-16 11:46:31

Pude usar este sitio para descargar e instalar curl fácilmente en mi máquina Windows. Tomó 30 segundos. Estoy usando Windows 7 (w / Admin privelages), así que he descargado curl-7.37.0-win64.msi de http://curl.haxx.se/download.html .

Además, no olvide reiniciar su consola/terminal después de instalar curl, de lo contrario recibirá los mismos mensajes de error.

 3
Author: maudulus,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-10-14 13:19:51
  1. Ir a curl Download Wizard
  2. Seleccione el ejecutable curl
  3. Seleccione Win32 o Win64
  4. Luego seleccione el paquete para él(por ejemplo genérico/cygwin) según su requisito
  5. Entonces tendrá que seleccionar la versión. Puede seleccionar sin especificar.
  6. Esto le llevará directamente al enlace de descarga que al hacer clic le dará una ventana emergente para descargar el archivo zip.
  7. Extrae el zip para obtener el ejecutable. Agregue esta carpeta en sus variables de entorno y estará Terminado. A continuación, puede ejecutar el comando curl desde cmd.
 2
Author: Aniket Thakur,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2014-05-05 08:37:50

Asumiendo que eres nuevo en el juego o no puedes instalar el software debido a restricciones de seguridad, podrías usar Scoop para instalar curl. Desde una ventana de powershell o de comandos, ejecute los siguientes comandos. Tenga en cuenta que esto supone que tiene Powershell v3.0+.

La otra ventaja interesante aquí es que esto instala el software solo para el usuario actual.

  1. Establecer excepción de ejecución

    Set-ExecutionPolicy -ExecutionPolicy Undefined -Scope CurrentUser
    
  2. Instalar Scoop

    iex (new-object net.webclient).downloadstring('https://get.scoop.sh')
    
  3. Instala curl. Es posible que vea una advertencia sobre un hash faltante, pero debería ver un mensaje final de que cURL se instaló correctamente

    scoop install curl
    
  4. Pruebe la instalación de curl

    curl -L https://get.scoop.sh
    
 2
Author: Ro Yo Mi,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2015-06-21 01:31:37

Descargar el .archivo exe de https://cygwin.com/install.html para cygwin (una gran colección de GNU y herramientas de Código Abierto que proporcionan una funcionalidad similar a una distribución de Linux en Windows).

Ejecute el .archivo exe.

Durante la instalación obtendrá en un paso para seleccionar paquetes. En la ventana seleccionar paquete change> cambie la vista a "No instalado" y busque curl. haga clic en los paquetes necesarios para instalar haciendo clic en la columna "nuevo" para el paquete > > puede ver el número de versión y luego hacer clic en siguiente. ( ver la imagen adjunta a continuación)introduzca la descripción de la imagen aquí

Después de terminar la instalación, haga clic en cygwin para abrir la consola curl en Windows y trabajar en los comandos curl.

 2
Author: Dhinakaran Kannan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-27 18:32:41

Estoy puede ser un poco tarde para esto, pero soy capaz de resolver mi problema de curl en cmd para windows 10.

Recibí ayuda del siguiente video tutorial https://www.youtube.com/watch?v=qlTVMuONazs

Aquí hay una explicación

Paso 1: vaya a https://curl.haxx.se/download.html

Paso 2: Buscar " Win64-Generic "y descargar" Win64 x86_64 7zip "de"Darren Owen"

Paso 3: descomprima el archivo de descarga e instale el certificado "ca-bundle.crt " do no toque curl.exe

Paso 4: en Windows vaya a "Panel de control" - > "Sistema" - > " Configuración avanzada del sistema " Paso 5: haga clic en Variables Envirnoment

Paso 6: En la variable del sistema haga clic en "Ruta" y pegue la ruta de la carpeta de archivos en mi caso es "C:\curl\curl_7_53_1_openssl_nghttp2_x64"

Y has terminado.

No se olvide de reiniciar el sistema por una vez

 2
Author: Kamran Sohail,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-04-25 06:09:29

Desde el símbolo del sistema de Windows, ejecute curl a través de Git Bash

"C:\\Users\\sizu\\AppData\\Local\\Programs\\Git\\bin\\sh.exe" --login -i -c "curl https://www.google.com"
 1
Author: Scott Izu,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-02-09 02:49:37

Para cualquiera que busque una solución rápida, después de haber instalado cygwin estándar pero descubrir que curl no funcionó en una plataforma win 10 x64:

Descargando este repositorio retirado, extrayéndolo y ejecutándolo:

Git-cmd.mtd

Funcionó a las mil maravillas. Supongo que tiene la opción preinstalada para curl.

 0
Author: a.t.,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2018-03-05 19:41:21