Last updated: Apr 4, 2024
Reading time·2 min

The error "'curl' is not recognized as an internal or external command,
operable program or batch file" occurs when we run the curl command on Windows
without having curl installed.
To solve the error, install curl using Chocolatey.
If you have Chocolatey installed:
Click on the Search bar and type PowerShell.
Right-click on the PowerShell application and click "Run as administrator".

curl.choco install curl -y
To install Chocolatey:

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

choco to make sure Chocolatey is installed.
Now that you have Chocolatey installed, run the following command to install
curl.
choco install curl -y
Note that your shell should still be run using elevated permissions.

Now you should be able to use the curl command.
Click on the Search bar, type "cmd" and start the Command Prompt application.
curl --version

You can get the main page from a web server with the following command.
curl https://www.example.com/

If you need to download a file, use the -o parameter to specify the output
file.
curl -o example.html http://www.example.com/

You can learn more about the related topics by checking out the following tutorials: