Search code examples
curlcmdwindows-10

Curl not working Windows 10 cmd


I have installed Curl on Windows 10, 64 bit OS.

Curl version is 7.57 and its path is C:\Program Files\curl-7.57.0\AMD64

I have copied the ca-bundle file to this location where curl.exe is present.

Also added this path in the System environment variable PATH.

But when I open the cmd and type curl, it gives no response whatsoever and also no error is seen.

What should be done to make curl work here? thanks.


Solution

  • cURL on Windows

    Skip to second section for more direct solutions

    I have had a lot of issues with cURL on Windows. For example, and I realize your issue is likely much different than this, the following cURL command for RabbitMQ's HTTP API works great on Linux but does not work with the latest version of cURL on Windows 10.

    curl -i -v -u root:root -H "content-type:application/json" -XPOST -d'{"vhost":"/","name":"amq.default","properties":{"delivery_mode":1,"headers":{}},"routing_key":"EMAIL","delivery_mode":"1","payload":"dasdfasdf","headers":{},"props":{},"payload_encoding":"string"}' http://localhost:15672/api/exchanges/%2f/amq.default/publish
    

    I realize this might be a roundabout answer but I would do the following:

    1. In your start menu search for settings and click it
    2. Select Updates and Security
    3. Select For Developers
    4. Enabled Developer Mode

    Once that is enabled restart your computer. Once the computer has started back up search for bash.exe. You now have access to an Ubuntu bash shell. Run cURL from there.

    You can read more about this from here

    More Direct solutions

    If you don't want to do that I can think of two other things.

    1. Place the binary (exe) file in your root c:\ drive and then update your path variable to reflect the new location. Sometimes windows environment variables don't like spaces. Similarly you can just put quotes around it "C:\Program Files\curl-7.57.0\AMD64"
    2. If the above doesn't work, ,ake sure your path variable is set in system variables and not overridden in user variables by a path variable that doesn't include the location of your cURL binary file
    3. If it still doesn't work then put the path of the curl binary as the first entry in your path variable. I've also had windows path variable break when an entry before it was messed up... although I think that might have been fixed with windows 10.

    Also, this is my personal preference, but I generally like to create create a new environment variable with the location. For example:

    CURL     -     "C:\Program Files\curl-7.57.0\AMD64"
    

    Then I append to the end of PATH a reference to the new CURL variable

    %CURL%
    

    I'm not saying this is necessary, just my preference. The double quotes will probably fix your issue though.