Pages

Saturday, February 5, 2022

Curl command throws error on Windows10

 Problem Statement: 

Windows 10 now comes equipped with cURL and we can use CURL as we use it in Linux. But many times curl commands with POST dont run as expected and throw some errors like 

Example: 

C:\WINDOWS\system32>curl --request POST 'https://<Your URL>'  --header 'Content-Type: application/x-www-form-urlencoded' --data-urlencode 'refresh_token=<Your Token>'

This command will throw following errors when you will run it on your CMD shell: 

curl: (3) URL using bad/illegal format or missing URL

curl: (6) Could not resolve host: application


Cause: 

I found these errors only present in CURL on Windows 10 (build 17063 or later), the Windows curl.exe native program  understands the single quotes and double quotes in different way. 


Solution: 

Change the single quotes (') in your curl command syntax with double quotes (") and it will run successfully. 



Cheers!!