How to use the curl command in PowerShell?

Am using the curl command in PowerShell to post the comment in bit-bucket pull request page through a Jenkins job. I used the below PowerShell command to execute the curl command, but am getting the error mentioned below. Could anyone please help me on this to get it worked?

$CurlArgument="-u -X POST --data content=success"
$CURLEXE='C:\Program Files\Git\mingw64\bin\curl.exe'
& $CURLEXE $CurlArgument

Error Details:

  • How to release automatically your artifact to GitHub
  • OpenWRT + https + git
  • How can I enable https for cURL request to api.github?
  • git client using GSSAPI for NTLM proxy authentication
  • Git doesn't work after a clean installation using macports due to libcurl.4.dylib version?
  • Trying to compile git but libcurl not found in linux
  • curl.exe : curl: no URL specified!
    At line:3 char:1
    + & $CURLEXE $CurlArgument
    + ~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: (curl: no URL specified!:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
    curl: try 'curl --help' or 'curl --manual' for more information

  • Proxy Issues with Install Module
  • Why I couldn't add the Git Url to my Jenkins?
  • Can two different jenkins builders exist in the same hpi and share the same global configuration?
  • Jenkins build failed on OSX
  • how to get git short hash in to a variable in Jenkins running on windows 2008
  • Unable to access Sonar MySQL database Caused by: java.sql.SQLException: Access denied for user 'sonar'@'glassfishdev.ccs.local' (using password: YES)
  • 2 Solutions collect form web for “How to use the curl command in PowerShell?”

    Use splatting.

    $CurlArgument = '-u', '',
                    '-X', 'POST',
                    '--data', 'content=success'
    $CURLEXE = 'C:\Program Files\Git\mingw64\bin\curl.exe'
    & $CURLEXE @CurlArgument

    In Powershell 3.0 and above there is both a Invoke-WebRequest and Invoke-RestMethod. Curl is actually an alias of Invoke-WebRequest in PoSH. I think using native Powershell would be much more appropriate than curl, but it’s up to you :).

    Invoke-WebRequest MSDN docs are here:

    Invoke-RestMethod MSDN docs are here:

    Git Baby is a git and github fan, let's start git clone.