86
38
Is there a way to install cURL
in windows in order to run cURL
commands from the command prompt?
86
38
Is there a way to install cURL
in windows in order to run cURL
commands from the command prompt?
74
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.
Related; can you also install libraries for https
? – CodyBugstein – 2014-10-29T19:40:44.893
4You don't need to reopen the console if you put it in a directory on the path, you only need to do that if you change the PATH variable. – Eltariel – 2012-05-11T03:24:36.207
One hard reboot later because I couldn't kill the task - um, you might wanna be careful with this. – CAD bloke – 2013-02-26T09:51:56.017
92
If you install Git for Windows you get Curl automatically too. There are some advantages:
PATH
setup during installation automatically.1This is probably the best all around solution since git is useful for many of the things that curl does but source wise. – cchamberlain – 2015-05-03T05:23:37.107
If you have Git, this is a great solution – Diode Dan – 2017-07-29T00:47:36.047
4Newer versions of git-for-windows do not come with curl in the path, you have to run /mingw64/bin/curl
. – dev0 – 2018-02-21T15:23:51.173
8I didn't know the git bash did the other stuff too :D Thanks a ton! – BRogers – 2013-12-15T18:23:24.370
worked like a charm! – Pedro – 2014-04-26T21:04:07.743
3
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
curl http://example.com/
in a more Unix-ish environment.
More information about net.webclient
is available here: WebClient Methods (System.Net).
1Exactly what I was looking for! I actually used the DownloadFile
method: powershell -Command "(new-object net.webclient).DownloadFile('http://.../somefile', 'file.txt')"
. You also just taught me how to use the PowerShell without opening its prompt. Thank you matty! – Armfoot – 2017-12-10T21:25:35.783
3
After installing OpenSSL Light, restart Windows, open Command Prompt, then do a test command like:
curl http://www.google.com
If you get HTML tags back, it worked.
3
How to setup cURL:
curl.exe
file into your Windows PATH
folder. By default, this is C:\Windows\System32
.cacert.pem
to curl-ca-bundle.crt
.PATH
folder.How to test it:
cmd.exe
to open your command prompt.2
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!
1
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/
0
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:
https://stackoverflow.com/questions/50724407/curl-command-in-git-bash
If your 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:
https://stackoverflow.com/questions/2594880/using-curl-with-a-username-and-password
0
No need to restart windows but restarting CMD is necessary.
I'm voting to close this question as off-topic because it was cross-posted on SO
– phuclv – 2018-08-20T06:46:24.973