'curl' is not recognized as an internal or external command

avatar
Borislav Hadzhiev

Last updated: Apr 4, 2024
2 min

banner

# 'curl' is not recognized as an internal or external command

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:

  1. Click on the Search bar and type PowerShell.

  2. Right-click on the PowerShell application and click "Run as administrator".

run powershell as administrator

  1. Run the following command to install curl.
PowerShell
choco install curl -y
If you don't have Chocolatey installed, you have to install it first.

To install Chocolatey:

  1. Open PowerShell as an administrator.

run powershell as administrator

  1. Run the following command.
PowerShell
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'))

windows install chocolatey

  1. Wait for the command to complete.
  2. Type choco to make sure Chocolatey is installed.

windows verify chocolatey installed

Now that you have Chocolatey installed, run the following command to install curl.

PowerShell
choco install curl -y

Note that your shell should still be run using elevated permissions.

chocolatey install curl

Now you should be able to use the curl command.

Click on the Search bar, type "cmd" and start the Command Prompt application.

cmd
curl --version

curl print version

You can get the main page from a web server with the following command.

cmd
curl https://www.example.com/

curl get main page from webserver

If you need to download a file, use the -o parameter to specify the output file.

cmd
curl -o example.html http://www.example.com/

curl download webpage to file

# Additional Resources

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

I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.