Is there a way to install
cURL in windows in order to run
cURL commands from the command prompt?
Download cURL for Windows from here (and be sure to select it from Win32 - Generic way down on the page).
Then place it in a directory inside your PATH environment variable (ie:
C:\Windows\System32) or run it with its full path preceding the executable name.
If you place it in a directory that's inside your PATH, make sure to close and then reopen command prompt to make the command available.
If you install Git for Windows you get Curl automatically too. There are some advantages:
- Git takes care of the
PATHsetup during installation automatically.
- You get the GNU bash, a really powerful shell, in my opinion much better than the native Windows console.
- You get many other useful Linux tools like tail, cat, grep, gzip, pdftotext, less, sort, tar, vim and even Perl.
After installing OpenSSL Light, restart Windows, open Command Prompt, then do a test command like:
If you get HTML tags back, it worked.
How to setup cURL:
- Download and unzip 64-bit cURL with SSL.
- Copy the
curl.exefile into your Windows
PATHfolder. By default, this is
- Download and install the Visual Studio 2010 C++ Runtime Redistributable 64 bit here.
- Download the latest bundle of Certficate Authority Public Keys from mozilla.org here.
- Rename this file from
- Move this file into your Windows
How to test it:
cmd.exeto open your command prompt.
- For both commands, you should see a couple pages of the HTML source code. If you see this, cURL is up and running!
Tar and Curl are available on Windows beginning in Insider Build 17063, as part of the Windows toolchain: curl and bsdtar.
Tar: A command line tool that allows a user to extract files and create archives. Outside of PowerShell or the installation of third party software, there was no way to extract a file from cmd.exe. The implementation uses libarchive.
Curl: Command line tool that allows for transferring of files to and from servers.
Note: PowerShell does already offer similar functionality (it has curl and it’s own file extraction utilities).
More info: Tar and Curl Come to Windows!
You can install this "cURL for Windows": cURL for Windows is an MSI installer for cURL, the popular command-line web transfer tool. http://www.confusedbycode.com/curl/
For folks that don't literally need the
curl executable, but rather just need to e.g. see or save the results of a GET request, can use
powershell directly. From a normal command prompt, type:
powershell -Command "(new-object net.webclient).DownloadString('http://example.com')"
which, while a bit wordy, is similar to typing
in a more Unix-ish environment.
More information about
net.webclient is available here: WebClient Methods (System.Net).
No need to restart windows but restarting CMD is necessary.
I used the answer provided by fuxia to run some bash scripts I had written in Linux on the Windows platform. It works very nicely.
A word of caution though with
cURL. I had an issue where I could not use Console interaction when authenticating as described here:
cURL command requires authentication and you do not want to have the password visible in the command line or stored in your script, you will have to use another solution, like using a password file: