1001Ferramentas
🪟 Converters

cURL → PowerShell / wget Converter

Converts cURL commands into PowerShell Invoke-RestMethod, Invoke-WebRequest or wget, preserving method, headers, body, auth and redirects.

Line continuations with \ or ^ are accepted, and so is the curl.exe prefix.


  

How the flags map

cURL PowerShell wget
-X POST-Method POST--method=POST
-H "K: V"-Headers $headers--header='K: V'
-d body-Body $body--body-data='body'
-u u:pAuthorization: Basic--user / --password
-k-SkipCertificateCheck--no-check-certificate
-L-MaximumRedirection 5default
-o file-OutFile "file"-O 'file'
--max-time 30-TimeoutSec 30--timeout=30

Everything runs in your browser: the command, the tokens, the credentials in -u. Basic auth is encoded to base64 locally, which is encoding and not encryption — anyone with the header can read the password back.

The same request, now in PowerShell

The API docs give the example in cURL, you are on Windows and you paste it into PowerShell expecting it to run. It does not: there curl is an alias for Invoke-WebRequest, which knows neither -H nor -d and answers with a parameter error. Paste the command here and it comes back as Invoke-RestMethod, Invoke-WebRequest or wget, with method, headers, body and auth in place.

The parser honours single and double quotes, line continuation with the bash backslash and the cmd caret, and recognises the options that actually show up in API snippets: -X, repeated -H, every flavour of -d, --data-urlencode, --json, -F, -u, -b, -A, -L, -k, -o, --max-time and -G. With -G the body becomes a query string on the URL, just as cURL would do.

Headers come out in their own hashtable, and the splatting checkbox swaps the one-line call for a parameter block that reads better once a request carries six options. Note that -k maps to -SkipCertificateCheck, which only exists from PowerShell 6 on, and that -u is base64 encoded in your browser: base64 is encoding, not encryption, so treat the generated command as a secret.

Frequently asked questions

Why does pasting cURL straight into PowerShell fail?
Because on Windows the name curl is an alias for Invoke-WebRequest, which takes a different parameter syntax. If real cURL is installed, calling curl.exe works; the alias does not.
Does the password from -u leave my computer?
No. The whole conversion runs in the browser and nothing is sent to any server. The user and password pair is base64 encoded locally and becomes the Authorization header.
Should I use Invoke-RestMethod or Invoke-WebRequest?
Invoke-RestMethod already hands back JSON parsed into an object, which is usually what you want from an API. Invoke-WebRequest returns the full response, with status, headers and the raw body.

Related Tools