Monday, June 27, 2016

How to call cURL from Command Line

Hi All,

I installed cURL tool on my windows 10 machine, after i installed it; I tried to use this tool to post JSON messages over HTTP web hook endpoint.  But when i open the command line and type in curl, i get the following error:

'curl' is not recognized as an internal or external command, operable program or batch file.

By default, when you install cURL it gets installed on this default directory:
C:\Program Files\cURL

If i navigate to the installation path in command line window and type in curl, the tool will start working. but because i don't want to remember this path every time i want to use this tool, i need to add it as a system variable so the system knows where to points to when i call it.

Here is how to accomplish this:

1) Open Control Panel.
2) Click on System and Security.
3) Click on Advanced system settings link on the left pane.
4) This will open system properties pop up window.
5) Click on Environment variables button from advanced tab.
6) Click on New button from Systems Variables section (bottom section).
7) Add the following variable name information:

Variable name: curl
Variable value: C:\Program Files\cURL\bin



8) Click on OK button.
9) Open a new window from command line and type curl.
10) Now you can start using curl tool from command line without the need to navigate to the installation directory of the tool.



Enjoy!


No comments: