Run cURL Commands in Windows 11 (with Examples)

Published by Nyau Wai Hoe - Updated on

The cURL command, short for “Client for URLs“, is a versatile command-line tool for transferring data across various network protocols. Supporting an extensive array of protocols such as HTTP, HTTPS, FTP, SMTP, and many more, it has found a central place in the toolkit of many network and system administrators.

Starting with Windows 10, Microsoft has included cURL by default in the Command Prompt. This means that Windows 11 also supports cURL commands without needing to install additional software. This comprehensive guide will focus on using cURL in the Command Prompt on Windows 11, covering various examples such as downloading and uploading files, sending an email, managing cookies, handling HTTP headers, dealing with SSL certificates, and more.

Run cURL Commands in Windows 11 Examples

Verifying cURL Installation in Windows 11

First, let’s verify that cURL is installed on your system. Open Command Prompt and type in the following command:

curl --version

Verifying cURL Installation in Windows 11

This command should display the installed version of cURL on your system, confirming its installation.

Also see: How to use FTP via Command Line (CMD) on Windows 11

Downloading Files with cURL

One of the most common uses of cURL is downloading files from the web. The process is simple and intuitive. To download a file, use the -O (or --remote-name) option followed by the URL of the file:

curl -O

This command will download the file myfile.txt from and save it in the current working directory.

Downloading Files with cURL in Windows CMD

To save the downloaded file with a different name, use the -o (or --output) option:

curl -o renamedfile.txt

The -o option followed by a filename allows you to specify a different name for the downloaded file.

Related resource: How to Download an FTP File Using CMD in Windows 11/10

Uploading a File using cURL

cURL enables file uploads to servers using several protocols, such as FTP, SFTP, and HTTP/HTTPS. Here’s an example using FTP:

curl -T localfile.txt --user username:password

Uploading a File using cURL

This command will upload localfile.txt from your local machine to via FTP. Replace username:password with your actual username and password for the FTP server.

Sending an Email with cURL

cURL’s support for the SMTP protocol means you can use it to send emails. This is particularly useful for sending automated notification emails from scripts. Here’s an example:

curl --url smtps:// --ssl-reqd --mail-from [email protected] --mail-rcpt [email protected] --upload-file email.txt --user username:password

In this example, email.txt is a text file containing the email’s subject, headers, and body. Replace, [email protected], [email protected], and username:password with your SMTP server details and email information.

Sending an Email with cURL in Windows 11

Managing Cookies with cURL

Cookies can be managed in cURL commands by using the -b (or --cookie) option to send cookies, and the -c (or --cookie-jar) option to store cookies. Here’s an example of sending a cookie:

curl -b "name=value"

And here’s an example of storing the server’s cookies into a file:

curl -c cookies.txt

Managing Cookies with cURL command in Windows

Setting HTTP Headers with cURL

In many instances, particularly when working with APIs, you may need to set specific HTTP headers in your request. This can be achieved with cURL using the -H (or --header) option:

curl -H "Content-Type: application/json" -H "Authorization: Bearer your_token"

Setting HTTP Headers with cURL command in Windows 11

Working with SSL Certificates

cURL allows you to troubleshoot SSL certificates, check their validity, and even download them. To check the validity of a certificate, you can use the following command:

curl -vI 2>&1 | findstr "expire date"

In this example, the command uses cURL to check the validity of an SSL certificate by retrieving the server’s response headers and searching for the “expire date” string. It allows for quick verification of SSL certificate expiration dates.

Linked issue: Fixing Website’s Security Certificate Error on Windows 11/10

Making POST Requests with cURL

A POST request is a way to send data to a server. With cURL, making POST requests is straightforward. Let’s say we want to send some JSON data to an API. We can do so like this:

curl -d "{'key1':'value1', 'key2':'value2'}" -H "Content-Type: application/json" -X POST

The -d (or --data) option specifies the data to be sent, while the -H (or --header) option sets the Content-Type header to application/json. The -X (or --request) option specifies that this is a POST request.


cURL is also invaluable when working with REST APIs, which use standard HTTP methods like GET, POST, PUT, DELETE, etc. We have already seen examples of GET (downloading files) and POST (sending data) operations. Now let’s look at how to use cURL for a PUT request, typically used for updating resources:

curl -d "{'key1':'value1', 'key2':'value2'}" -H "Content-Type: application/json" -X PUT

And here’s how to make a DELETE request, used to delete a resource:

curl -X DELETE

Concluding Thoughts

Running cURL from the Command Prompt in Windows 11 is not only a simple process, but also a powerful tool that allows you to interact with web services directly from your machine, automating tasks, testing web servers, and much more. It’s a tool that is as powerful as it is ubiquitous – cURL is essentially available on every platform, making your scripts portable and universal.

If you’re ever unsure about a cURL command or need to check how to write one, don’t forget you have a handy helper: the curl --help command. This is like a mini instruction book right at your fingertips, giving you a fast rundown of what cURL can do. It’s the first place to go if you have questions or need help with cURL.

Run cURL commands in Windows

Nyau Wai Hoe
Nyau Wai Hoe is the Founder and Chief Editor of With a degree in software engineering and over 12 years of experience in the tech support industry, Nyau has established himself as an expert in the field, with a primary focus on the Microsoft Windows operating system. As a tech enthusiast, he loves exploring new technologies and leveraging them to solve real-life problems.

Share via
Copy link