Run cURL commands from Windows console
Solution 1
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.
Solution 2
If you install Git for Windows you get Curl automatically too. There are some advantages:
- Git takes care of the
PATH
setup 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.
Solution 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.
Solution 4
How to setup cURL:
- Download and unzip 64-bit cURL with SSL.
- Copy the
curl.exe
file into your WindowsPATH
folder. By default, this isC:\Windows\System32
. - 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
cacert.pem
tocurl-ca-bundle.crt
. - Move this file into your Windows
PATH
folder.
How to test it:
- Run
cmd.exe
to 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!
Solution 5
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).
Related videos on Youtube
user3469203
Electrical Engineering (telecommunications specialist) & Programmer, IT entrepreneur.
Updated on September 18, 2022Comments
-
user3469203 almost 2 years
Is there a way to install
cURL
in windows in order to runcURL
commands from the command prompt?-
phuclv almost 6 yearsI'm voting to close this question as off-topic because it was cross-posted on SO
-
-
Eltariel about 12 yearsYou 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.
-
CAD bloke over 11 yearsOne hard reboot later because I couldn't kill the task - um, you might wanna be careful with this.
-
pedrommuller about 10 yearsworked like a charm!
-
CodyBugstein over 9 yearsRelated; can you also install libraries for
https
? -
cchamberlain about 9 yearsThis is probably the best all around solution since git is useful for many of the things that curl does but source wise.
-
Diode Dan almost 7 yearsIf you have Git, this is a great solution
-
Armfoot over 6 yearsExactly 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! -
dev0 over 6 yearsNewer versions of git-for-windows do not come with curl in the path, you have to run
/mingw64/bin/curl
.