2

I have a path for folder containing curl.exe file (C:\My\Custom\Directory\) added to Path Environment Variable. The problem is that when I call curl from command line, it runs another curl executable than the intended one. When I traced which executable was running using Process Explorer, I found it in C:\Windows\System32\ (may be installed after the new Windows Update). The problem with this is that this executable doesn't support some features I use.

What I need to do is to override curl to call curl.exe from C:\My\Custom\Directory\ instead of calling it from C:\Windows\System32\.

Notes:
I know I can use "C:\My\Custom\Directory\curl.exe" in command line, but I want to use curl only to call curl.exe from my custom directory.
Also I can't delete C:\Windows\System32\ from the Path variable because it contains other important executable, and I think I can't.

2
  • 3
    Put your curl directory path at the start of the PATH environment variable rather than the end.
    – Mokubai
    Jun 4, 2018 at 12:05
  • 1
    Why not modify the order in the path to have your `C:\My\Custom\Directory` in front. There is a curl.exe with the very last update. Fall update doesn't have it.
    – LotPings
    Jun 4, 2018 at 12:07

1 Answer 1

4

The order of %path% items matters. You can check it using where curl.exe

Thanks to JosefZ and everyone commented.

1
  • 3
    If moving C:\My\Custom\Directory above C:\Windows\System32 in the PATH order causes unintended side-effects, then another option is to use an alias doskey curl=C:\My\Custom\Directory\curl.exe, though it will work only from the command line, not in a batch file. The alias check precedes any PATH search.
    – AFH
    Jun 4, 2018 at 13:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.