curl

Windows CMD · Network · reference only

What it does

Transfers data to or from a server by URL (HTTP, HTTPS, FTP...). It ships with Windows 10 and 11 as curl.exe.

Syntax

curl [opciones] URL

Options and parameters

  • -o fichero

    Saves the response to that file instead of showing it.

  • -O

    Saves the response with the name it has on the server.

  • -L

    Follows redirects.

  • -I

    Requests only the response headers.

  • -X método

    Uses that HTTP method, such as POST or DELETE.

  • -H "cabecera"

    Adds a header to the request.

  • -d datos

    Sends that data in the body of a POST request.

Usage examples

  • curl https://example.com

    Shows the page's code on screen.

  • curl -I https://example.com

    Shows only the headers: status code, content type...

  • curl -L -o pagina.html https://example.com

    Downloads the page following redirects and saves it as pagina.html.

  • curl -X POST -d "usuario=ana" https://example.com/login

    Submits a form by POST.

Notes and common mistakes

  • In PowerShell, curl is an alias for Invoke-WebRequest: type curl.exe to use the real tool.
  • In CMD, use double quotes for arguments with spaces.

Related commands