# curl on Windows and PowerShell: how to run it and why commands fail

Source: https://checkcraft.ru/en/guides/curl-windows-powershell.html · updated 2026-12-02

How to use curl on Windows: the built-in curl.exe, why curl in Windows PowerShell 5.1 is Invoke-WebRequest…

Practical workflow

Checkcraft is a desktop app for checking APIs and logs without code, with a free edition. [Download, no sign-up →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

Windows 10 and 11 ship curl.exe, but commands from docs often fail. Two reasons: in Windows PowerShell 5.1 the word curl is an alias for Invoke-WebRequest with different parameters, and quotes and line continuation in cmd and PowerShell differ from Linux. Below is how to run the real curl and rewrite commands.

Checkcraft · 24 November 2026

Get help with your first test →

## curl or curl.exe

In cmd the curl command runs the real curl. In Windows PowerShell 5.1 curl is an alias for Invoke-WebRequest, so -H and -d fail with a parameter error. Type curl.exe explicitly. PowerShell 7 removed the alias, but curl.exe is still safer in scripts run on different machines.

## Quotes and JSON

On Linux the JSON body goes in single quotes. In cmd single quotes do not work: wrap everything in double quotes and escape inner double quotes with a backslash. The most reliable way on any system is to put the JSON in a file and pass it with --data @body.json.

Repeating checks like this by hand? Checkcraft saves them and reruns them in one click. [Download Free →](https://checkcraft.ru/en/download-checkcraft.html#free-download)

## Continuing a long command

A trailing backslash continues a command only in bash. cmd uses ^ and PowerShell uses a backtick. When copying a command from docs or Postman, it is easier to put it on one line first.

## Commands for cmd and PowerShell

```
REM cmd: JSON в двойных кавычках, внутренние кавычки экранированы
curl -X POST https://api.example.com/v1/orders -H "Content-Type: application/json" -d "{\"sku\":\"MON-24\",\"qty\":2}"

REM cmd: тело из файла, работает везде
curl -X POST https://api.example.com/v1/orders -H "Content-Type: application/json" --data @body.json

# PowerShell: явный curl.exe, перенос строки обратным апострофом
curl.exe -X POST https://api.example.com/v1/orders `
  -H "Content-Type: application/json" `
  --data "@body.json"

# PowerShell: токен из переменной
curl.exe -H "Authorization: Bearer $env:TOKEN" https://api.example.com/v1/orders
```

## Linux, cmd and PowerShell side by side

|  | bash | cmd | PowerShell |
|---|---|---|---|
| Command | curl | curl | curl.exe |
| Quotes around JSON | Single | Double, escaped | File via @ |
| Line continuation | \ | ^ | backtick |
| Variable | $TOKEN | %TOKEN% | $env:TOKEN |

## Common errors

- Cannot bind parameter Headers. Invoke-WebRequest ran instead of curl; type curl.exe.
- The server answers 400 to JSON. Quotes inside the body got lost; send the body from a file.
- curl not found. An old Windows build without curl.exe; install curl from the official site.

More POST samples with JSON are in [curl POST with JSON](https://checkcraft.ru/en/guides/curl-post-json.html).

## More on curl

Section overview and all guides: [curl command cheat sheet: flags and examples for APIs](https://checkcraft.ru/en/guides/curl-cheat-sheet.html).

- [Download a file with curl: -o, -O, redirects and resume](https://checkcraft.ru/en/guides/curl-download-file.html)
- [curl through a proxy: -x, environment variables, SOCKS and no_proxy](https://checkcraft.ru/en/guides/curl-proxy.html)
- [PHP cURL: GET and POST requests with JSON, headers and error handling](https://checkcraft.ru/en/guides/php-curl.html)
- [Webhook: what it is, how it works and how to test it](https://checkcraft.ru/en/guides/webhook-testing.html)
- [curl GET request: parameters, response headers and status code](https://checkcraft.ru/en/guides/curl-get-request.html)

Next step

## Repeat this on your own API

Checkcraft is a desktop app that saves API response checks without code and shows what did not match. Start with a sample, then use your own sanitized data. Free runs on Windows and Linux with no time limit.

[Download Free](https://checkcraft.ru/en/download-checkcraft.html#free-download) · [Download and first run](https://checkcraft.ru/en/download-checkcraft.html)

No sign-up or email needed, the archive is ready in a couple of minutes. See the [edition limits](https://checkcraft.ru/en/pricing.html).

## References

[curl for Windows](https://curl.se/windows/) · [curl man page and exit codes](https://curl.se/docs/manpage.html)

## Continue with a related task

[cURL examples: GET and POST requests with JSON on Linux, Windows and PowerShell](https://checkcraft.ru/en/guides/curl-post-json.html) · [curl with authorization: Bearer token, Basic, API key and headers](https://checkcraft.ru/en/guides/curl-authorization-header.html) · [curl errors: codes 6, 7, 22, 28, 35, 60 and how to fix them](https://checkcraft.ru/en/guides/curl-errors.html) · [How to import cURL into Postman: paste the command and get a ready request](https://checkcraft.ru/en/guides/postman-import-curl.html)

Start with the linked example and compare its result with your own test requirement.

Ask a person

## Get help with your first test

Tell us what you want to test or where you got stuck. We can help you start Checkcraft, choose an example and understand your first run. You can ask before downloading.

[Ask in Telegram](https://t.me/checkcraftchat)Send an email

The Telegram group is public: do not post passwords, tokens or confidential work data. A description of your task is enough to start.

You can also email us support@checkcraft.ru

Page card: /ai/pages/en/guides/curl-windows-powershell.md
