Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is there an equivalent of curl in PowerShell? Does it have some similar built-in capability or is there a 3rd party cmdlet?

share|improve this question

migrated from Oct 10 '11 at 11:36

This question came from our site for professional and enthusiast programmers.

Closed? How about closing…;,…,… and host of others? – Borek Oct 10 '11 at 12:39
Actually this question looks fair enough to me? But there's an old answer:… – Rup Oct 10 '11 at 12:49
@Spoike Nice solution, you should post it as an answer. – Borek Jan 22 '13 at 14:55
up vote 43 down vote accepted

PowerShell 3.0 has the new command Invoke-RestMethod:

more detail:

share|improve this answer
You may want the Invoke-WebRequest command instead, depending on what you are trying to accomplish. – Timothy Lee Russell Jun 10 '14 at 16:32
It's also aliased as curl or wget in Powershell now. – CMCDragonkai Jun 12 '14 at 5:49
Yeah it's bizarre that they'd alias them, as the syntax is entirely different. If MS doesn't want to ship a package manager and make it easy to get common, basic tools, hiding it behind a fake alias isn't gonna make the situation better. – MichaelGG Nov 7 '14 at 20:08

The excellent Command Line Kung Fu blog has a post where they compare curl, wget and the related PowerShell commands

In a nutshell:

(New-Object System.Net.WebClient).DownloadString("","C:\hello-world.html")

Or, if your version of Powershell/.Net doesn't accept 2 parameters for DownloadString:

(New-Object System.Net.WebClient).DownloadString("") > "C:\hello-world.html"
share|improve this answer
This answer mentions the DownloadFile function which works well too. – Paul Hicks May 19 at 22:36

You can install cURL with Chocolatey and have curl available in PowerShell CLI or cmd.

share|improve this answer

You can also install Git for Windows, and then put the Git bin folder in your path. The Git install includes, among other things, curl.exe. After installing, just put %programfiles(x86)%\git\bin in your PATH. Then you'll be able to use the curl command from the Windows Command Prompt or PowerShell console.

share|improve this answer

As of Powershell 5.0, if not before, curl is an alias for Invoke-WebRequest.

PS> Get-Alias -Definition Invoke-WebRequest | Format-Table -AutoSize

CommandType Name                      Version Source
----------- ----                      ------- ------
Alias       curl -> Invoke-WebRequest
Alias       iwr -> Invoke-WebRequest
Alias       wget -> Invoke-WebRequest

To use the unaliased command ...

PS> Invoke-WebRequest -Uri https://localhost:443/
PS> Invoke-WebRequest -Uri

So return several properties of the request as follows ...

PS> Invoke-WebRequest -Uri

StatusCode        : 200
StatusDescription : OK
Content           : <!doctype html><html itemscope="" itemtype="" lang="en-AU"><head><meta content="text/html; charset=UTF-8"
                    http-equiv="Content-Type"><meta content="/images/branding/googleg/1x/...
RawContent        : HTTP/1.1 200 OK
                    X-XSS-Protection: 1; mode=block
                    X-Frame-Options: SAMEORIGIN
                    Vary: Accept-Encoding

... or just the content ...

PS> Invoke-WebRequest -Uri | Select-Object -ExpandProperty Content

<!doctype html><html itemscope="" itemtype="http://schem[etc ...]

The equivalent aliased commands are ...

PS> curl -Uri
PS> curl -Uri | Select-Object -ExpandProperty Content

Leveraging Powershell defaults and other aliases you could shorten the commands to

PS> curl 
ps> curl | Select -ExpandProperty Content

... but I wouldn't recommend it. Verbose commands help others when reading your code.

share|improve this answer

the closest thing to wget or curl on windows is bits (Background Intelligent Transfer Service), which has some snippets ready for powershell.

share|improve this answer
I think BITS solves a different problem than wget or curl. – ongle Jul 7 '12 at 1:08
Fetching things from a Http-Server? – akira Jul 7 '12 at 19:03
No :), the background intelligence part of it. – ongle Jul 7 '12 at 20:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .