0

I am giving a curl command in powershell like : curl -u username:password

and it throws the below error:

Invoke-WebRequest : Parameter cannot be processed because the parameter name 'u' is ambiguous. Possible matches include: -UseBasicParsing -Uri -UseDefaultCredentials -UserAgent. At C:\Users\PrasadKRampure\Desktop\Untitled2.ps1:4 char:6

  • curl -u ${Username}:${Password} http://*****/job/remote- ...
  •  ~~
    
    • CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
    • FullyQualifiedErrorId : AmbiguousParameter,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

But the same command work fine from command prompt.

mklement0
  • 382,024
  • 64
  • 607
  • 775
Prasad
  • 11
  • 1
  • 1
    In short: In _Windows PowerShell_ (but no longer in _PowerShell (Core) 7+_) `curl` is built-in alias of `Invoke-WebRequest`, whose syntax is very different from that of `curl.exe`. To reliably invoke the latter, invoke it _with `.exe`_ (`curl.exe -u ...`) – mklement0 Sep 25 '22 at 17:11

0 Answers0