Matheus Leão
Matheus Leão

Reputation: 437

cURL not recognizing command line parameters (Windows 10)

Not sure what I'm doing wrong, but any command line parameters I try to pass into curl (using double dash) are interpreted as a url. Running curl --help:

curl : The remote name could not be resolved: '--help'
At line:1 char:1
+ curl --help
+ ~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
   eption
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

With a single dash it seems to interpret a url parameter, but it doesn't find certain parameters. Running curl -sSL:

Invoke-WebRequest : A parameter cannot be found that matches parameter name 'sSL'.
At line:1 char:6
+ curl -sSL
+      ~~~~~
    + CategoryInfo          : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Curl binary downloaded from https://curl.se/windows/

Upvotes: 0

Views: 6792

Answers (1)

Antoine Aumjaud
Antoine Aumjaud

Reputation: 70

You can find the answer here: Running curl via powershell - how to construct arguments?

"In PowerShell curl is a built in alias to Invoke-WebRequest cmdlet. And aliases have priority in command resolution. To solve your problem you have more specifically, use curl.exe instead of curl, so command not resolved to alias"

Upvotes: 4

Related Questions