curl.exe: Your Guide to Windows Command Line File Transfers

curl.exe is a powerful command-line tool built into Windows 10 and 11 that lets you transfer data to and from servers using URLs. If you need to download files, test APIs, send data, or automate web requests without installing extra software, curl.exe is already waiting on your system.

This guide shows you exactly how to use it.

What Is curl.exe and Why Should You Care?

curl.exe is the Windows executable version of cURL (Client URL), a free tool created by Daniel Stenberg in 1997. Microsoft included it natively in Windows starting with version 10 build 1803 (April 2018).

Table of Contents

What it does:

  • Downloads files from the internet
  • Tests web APIs and REST endpoints
  • Sends HTTP requests (GET, POST, PUT, DELETE)
  • Handles authentication
  • Works with HTTPS, FTP, SFTP, and 20+ other protocols
  • Automates data transfers in scripts

Why developers and IT professionals use it: You don’t need a browser or third-party download manager. Everything happens in the command prompt with precise control over headers, methods, authentication, and error handling.

curl.exe Your Guide to Windows Command Line File Transfers

Checking If curl.exe Is Installed on Your Windows System

Open Command Prompt or PowerShell and type:

curl --version

You’ll see output showing the curl version, supported protocols, and features. If you get an error, you’re likely on an older Windows build. Update Windows or download curl from the official curl website.

See also  Software Documentation Best Practices: The Complete Guide for 2026

Important note for PowerShell users: Windows PowerShell has a Invoke-WebRequest alias also called curl. To use the actual curl.exe in PowerShell, type curl.exe instead of just curl, or remove the alias with Remove-Item alias:curl.

Basic curl.exe Syntax and Structure

Every curl command follows this pattern:

curl [options] [URL]

The URL tells curl where to connect. Options modify behavior like output location, request method, or headers.

Your First curl Command

Download a web page and display it in the terminal:

curl.exe https://example.com

The HTML content appears directly in your console. Not very useful for most tasks, but it proves curl works.

Downloading Files with curl.exe

Save a File to Your Current Directory

curl.exe -O https://example.com/file.zip

The -O flag (capital O) saves the file with its original name. curl downloads file.zip to wherever your command prompt is currently located.

Save with a Custom Filename

curl.exe -o myfile.zip https://example.com/file.zip

The -o flag (lowercase o) lets you specify any filename you want.

Download Multiple Files at Once

curl.exe -O https://example.com/file1.zip -O https://example.com/file2.zip

curl processes each URL in sequence.

Resume an Interrupted Download

curl.exe -C - -O https://example.com/largefile.iso

The -C - flag tells curl to continue from where it stopped. Extremely useful for large files on unstable connections.

Working with HTTP Methods and APIs

Sending a GET Request

curl.exe https://api.example.com/users

GET is the default method. This retrieves data from the server.

Sending a POST Request with Data

curl.exe -X POST -d "username=john&password=secret" https://api.example.com/login

The -X flag specifies the HTTP method. The -d flag sends data in the request body.

Sending JSON Data to an API

curl.exe -X POST -H "Content-Type: application/json" -d "{\"name\":\"John\",\"age\":30}" https://api.example.com/users

The -H flag adds custom headers. APIs often require Content-Type: application/json when you’re sending JSON.

Reading Data from a File

Instead of typing JSON in the command:

curl.exe -X POST -H "Content-Type: application/json" -d @data.json https://api.example.com/users

The @ symbol tells curl to read from data.json.

PUT and DELETE Requests

curl.exe -X PUT -d "status=updated" https://api.example.com/users/123
curl.exe -X DELETE https://api.example.com/users/123

These modify or remove resources on the server.

Authentication with curl.exe

Basic Authentication

curl.exe -u username:password https://api.example.com/protected

The -u flag handles HTTP Basic Authentication. curl encodes your credentials automatically.

Bearer Token Authentication

curl.exe -H "Authorization: Bearer YOUR_TOKEN_HERE" https://api.example.com/protected

Common for modern APIs using OAuth or JWT tokens.

Using a .netrc File for Credentials

Create a file named _netrc in your home directory (C:\Users\YourName\_netrc) with this format:

machine api.example.com
login yourusername
password yourpassword

Then run:

curl.exe -n https://api.example.com/protected

The -n flag tells curl to read credentials from the .netrc file. Never store passwords in scripts this way on shared systems.

Custom Headers and User Agents

Adding Custom Headers

curl.exe -H "X-Custom-Header: value" -H "Another-Header: value2" https://api.example.com

Stack multiple -H flags for multiple headers.

Changing the User Agent

Some servers block requests without a browser user agent:

curl.exe -A "Mozilla/5.0 (Windows NT 10.0; Win64; x64)" https://example.com

The -A flag sets the User-Agent header.

See also  HDMI Port Not Working: How to Fix It Fast

Handling Cookies and Sessions

Saving Cookies to a File

curl.exe -c cookies.txt https://example.com/login -d "username=john&password=secret"

The -c flag saves cookies to cookies.txt.

Sending Cookies from a File

curl.exe -b cookies.txt https://example.com/dashboard

The -b flag loads cookies from the file. This maintains your session across requests.

Using Cookies in the Same Command

curl.exe -c cookies.txt -b cookies.txt https://example.com/login -d "user=john&pass=secret"
curl.exe -b cookies.txt https://example.com/protected-page

First command saves cookies, second command uses them.

Following Redirects and Handling HTTPS

Following Redirects Automatically

Many URLs redirect to other locations. Without special flags, curl doesn’t follow them:

curl.exe -L https://example.com/redirect

The -L flag makes curl follow redirects until it reaches the final destination.

Ignoring SSL Certificate Errors

Not recommended for production, but useful for testing:

curl.exe -k https://self-signed-cert.example.com

The -k flag (or --insecure) bypasses certificate validation. Only use this when you trust the server.

Verbose Output and Debugging

See the Full Request and Response

curl.exe -v https://example.com

The -v flag shows everything: connection details, headers sent, headers received, and the response body. Essential for debugging API issues.

Show Only Headers

curl.exe -I https://example.com

The -I flag sends a HEAD request, returning only HTTP headers without the body.

Silent Mode

Hide progress meters and error messages:

curl.exe -s https://example.com

The -s flag runs curl silently. Useful in scripts where you want clean output.

Practical Examples for Real World Tasks

Download a GitHub Release File

curl.exe -L -o app.exe https://github.com/user/repo/releases/download/v1.0/app.exe

Check Website Response Time

curl.exe -o nul -s -w "Time: %{time_total}s\n" https://example.com

The -w flag formats output. This shows total request time without displaying the page content.

Test API Endpoint Health

curl.exe -I https://api.example.com/health

Returns status code and headers quickly.

Upload a File via FTP

curl.exe -T localfile.txt ftp://ftp.example.com/ --user username:password

The -T flag uploads files to FTP servers.

Download Files Listed in a Text File

Create urls.txt with one URL per line, then:

curl.exe -K urls.txt -O

Wait, that won’t work correctly. Better approach:

for /F %i in (urls.txt) do curl.exe -O %i

This loops through each URL and downloads it.

Common curl.exe Options

Here’s a quick reference table:

OptionPurposeExample
-oSave with custom filenamecurl.exe -o file.txt url
-OSave with original filenamecurl.exe -O url
-LFollow redirectscurl.exe -L url
-XSpecify HTTP methodcurl.exe -X POST url
-dSend datacurl.exe -d "key=value" url
-HAdd custom headercurl.exe -H "Header: value" url
-uBasic authenticationcurl.exe -u user:pass url
-ASet user agentcurl.exe -A "agent" url
-vVerbose outputcurl.exe -v url
-sSilent modecurl.exe -s url
-IFetch headers onlycurl.exe -I url
-kIgnore SSL errorscurl.exe -k url
-CResume downloadcurl.exe -C - -O url
-bSend cookiescurl.exe -b cookies.txt url
-cSave cookiescurl.exe -c cookies.txt url

Automating Tasks with curl.exe in Batch Scripts

Create a file named download.bat:

@echo off
curl.exe -O https://example.com/file1.zip
curl.exe -O https://example.com/file2.zip
curl.exe -O https://example.com/file3.zip
echo Downloads complete!
pause

Double-click to run. curl processes each download sequentially.

See also  DAO Governance Tokens Explained: Guide to Decentralized Democracy in 2026

Error Checking in Scripts

@echo off
curl.exe -o file.zip https://example.com/file.zip
if %errorlevel% neq 0 (
    echo Download failed!
    exit /b 1
)
echo Download successful!

curl returns exit code 0 on success, non-zero on failure.

Rate Limiting and Throttling Downloads

Limit Download Speed

curl.exe --limit-rate 100K -O https://example.com/largefile.iso

This caps speed at 100 kilobytes per second. Useful when you don’t want to saturate your connection.

Add Delays Between Requests

In a loop script:

for /F %i in (urls.txt) do (
    curl.exe -O %i
    timeout /t 5 /nobreak
)

This waits 5 seconds between downloads.

Troubleshooting Common curl.exe Problems

Problem: “curl is not recognized as an internal or external command”

Solution: You’re on an older Windows version. Update to Windows 10 1803 or later, or download curl manually from curl.se.

Problem: SSL certificate verification failed

Solution: The server uses a self-signed or expired certificate. Use -k to bypass (only for testing), or update your system’s CA certificates.

Problem: Downloads are slow

Solution: Your connection may be throttled, or the server limits speed. Check with --limit-rate removed to test maximum speed.

Problem: Getting HTML instead of JSON from an API

Solution: Add the Accept header: curl.exe -H "Accept: application/json" url

Problem: PowerShell shows weird output

Solution: Use curl.exe explicitly, or remove the PowerShell alias with Remove-Item alias:curl.

Problem: Authentication fails

Solution: Check if your credentials are correct. Try verbose mode (-v) to see what curl sends. Some APIs require specific header formats.

Security Considerations When Using curl.exe

Never put passwords directly in scripts that others can read. Use environment variables:

set API_KEY=your_secret_key
curl.exe -H "Authorization: Bearer %API_KEY%" https://api.example.com

Or use .netrc files with proper permissions.

Always validate SSL certificates in production (-k is for testing only).

Be careful with curl in scripts that run automatically. A malicious URL could cause unexpected behavior.

Comparing curl.exe to Other Tools

curl vs wget: wget is designed primarily for downloading files recursively. curl handles more protocols and is better for API testing and interactive HTTP work.

curl vs Invoke-WebRequest (PowerShell): PowerShell’s cmdlet is more verbose but integrates better with PowerShell pipelines and object manipulation. curl.exe is faster for simple tasks.

curl vs Postman: Postman has a GUI and better organization for API collections. curl is scriptable and doesn’t require installing software.

curl vs browser downloads: Browsers are easier for one-off downloads. curl excels at automation, scripting, and precise control over requests.

Advanced Techniques and Tips

Parallel Downloads in PowerShell

$urls = @(
    "https://example.com/file1.zip",
    "https://example.com/file2.zip",
    "https://example.com/file3.zip"
)

$urls | ForEach-Object -Parallel {
    curl.exe -O $_
} -ThrottleLimit 3

This downloads 3 files simultaneously (requires PowerShell 7+).

Using curl.exe with Proxies

curl.exe -x http://proxy.example.com:8080 https://example.com

The -x flag routes traffic through a proxy server.

Converting curl Commands from Browser DevTools

Chrome and Firefox let you copy network requests as curl commands. Right-click on any request in the Network tab, select “Copy as cURL”, then paste into your terminal. Replace curl with curl.exe on Windows.

Testing Download Speed

curl.exe -o nul -s -w "Downloaded at %{speed_download} bytes/sec\n" https://example.com/testfile

Shows average download speed without saving the file.

Conclusion: Master curl.exe for Better Command Line Productivity in 2026

curl.exe gives you direct control over file transfers and HTTP requests without leaving the terminal. You can download files, test APIs, automate data exchanges, and debug web services using one lightweight tool already installed on modern Windows systems.

Start with basic downloads using -O, then explore API testing with -X and -d. Add authentication with -u or headers with -H as your needs grow. Use -v to understand what’s happening behind the scenes.

The best way to learn curl is to use it. Pick a real task you need to automate, write the curl command, test it, and refine. Every developer and system administrator benefits from knowing this tool.

Frequently Asked Questions

Is curl.exe safe to use?

Yes. curl.exe is an official Microsoft-included tool in Windows 10 and 11. It’s the same trusted open-source curl software used by millions of developers worldwide. Just avoid using -k to bypass SSL certificates in production environments.

How do I install curl on older Windows versions?

Download the Windows binary from the official curl website (curl.se/download.html). Extract the files and add the folder to your system PATH, or run curl.exe directly from the extracted location.

Can curl.exe upload files to websites?

Yes. Use -F for form uploads: curl.exe -F "file=@localfile.jpg" https://example.com/upload. For FTP uploads, use -T: curl.exe -T file.txt ftp://server.com/.

Why does my POST request fail with “Unsupported Media Type”?

The server expects a specific Content-Type header. Add -H "Content-Type: application/json" for JSON APIs or -H "Content-Type: application/x-www-form-urlencoded" for form data.

How do I see the HTTP status code in curl?

Use the write-out option: curl.exe -s -o nul -w "%{http_code}" https://example.com. This displays only the status code (200, 404, 500, etc.) without the response body.

MK Usmaan