What’s that? cURL in PowerShell? What are you doing he-you’re just Invoke-WebRequest aren’t you?
Yep! You can kind of use cURL commands in Windows Powershell. This “cURL” is actually just an alias of Invoke-WebRequest.
Get-Command curl
Which will return:
CommandType Name Version Source ----------- ---- ------- ------ Alias curl -> Invoke-WebRequest
Very sneaky PowerShell. You can use curl instead of entering Invoke-WebRequest and still use the same parameters of Invoke-WebRequest (ie. -Uri, -Body, -Method). This also means you can’t use the parameters of the actual cURL (ie. -X
, -H
, -d
). With that in mind, you can do something that looks like a cURL GET request:
curl "https://reqbin.com/echo"
and get back:
StatusCode : 200 StatusDescription : OK Content : <html><head><title>ReqBin Echo</title><meta name="description" content="ReqBin Echo Interface"><meta charset="utf-8"><meta name="viewport" content="width=device-width"><link rel="shortcut icon" href="... RawContent : HTTP/1.1 200 OK Transfer-Encoding: chunked Connection: keep-alive Access-Control-Allow-Origin: * CF-Cache-Status: HIT Age: 6732 Expect-CT: max-age=604800, report-uri="https://report-uri.cloudfla... Forms : {} Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Access-Control-Allow-Origin, *], [CF-Cache-Status, HIT]...} Images : {} InputFields : {} Links : {} ParsedHtml : mshtml.HTMLDocumentClass RawContentLength : 643
Pretty neat!