Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 stackoverflow.com Oct 10 '11 at 11:36

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

1  
Closed? How about closing superuser.com/questions/34492/…;, superuser.com/questions/295021/…, superuser.com/questions/71446/… and host of others? –  Borek Oct 10 '11 at 12:39
1  
Actually this question looks fair enough to me? But there's an old answer: stackoverflow.com/questions/340553/… –  Rup Oct 10 '11 at 12:49
    
@Spoike Nice solution, you should post it as an answer. –  Borek Jan 22 '13 at 14:55

5 Answers 5

up vote 20 down vote accepted

PowerShell 3.0 has the new command Invoke-RestMethod:

http://technet.microsoft.com/en-us/library/hh849971.aspx

more detail:

http://www.discoposse.com/index.php/2012/06/30/powershell-invoke-restmethod-putting-the-curl-in-your-shell/

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 at 16:32
1  
It's also aliased as curl or wget in Powershell now. –  CMCDragonkai Jun 12 at 5:49

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("http://www.example.com/hello-world.html","C:\hello-world.html")

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

(New-Object System.Net.WebClient).DownloadString("http://www.example.com/hello-world.html") > "C:\hello-world.html"
share|improve this answer

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

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
1  
No :), the background intelligence part of it. –  ongle Jul 7 '12 at 20:03

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.