curl – resolving error – curl : The remote name could not be resolved: ‘–help’

curl error - The remote name could not be resolved: '--help'
curl error - The remote name could not be resolved: '--help'

Hi All,

Greetings for the day 🙂 LIFE IS BEAUTIFUL 🙂

Today again new issue and solution 🙂

Since working on curl for executing SharePoint REST API. Exploring curl and trying to get resolve issues

Background : From one of the UNIX team I got the request that they want to get documents list from our SharePoint Online site. They need REST API for the same and that they can execute with CURL

Since curl is new for me, started exploring and first step is getting curl help

I started SharePoint Online Management Shell and executed following command (We could execute the CMDLET in PowerShell ISE as well)

curl --help

On execution of above command I got the following issue :

curl : The remote name could not be resolved: ‘–help’

At line:1 char:1curl –help

+curl –help

+~~~

CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Fig 1 : curl – error – The remote name could not be resolved –help

But when I execute same command with “.exe” extension as follows I am getting the result. So bit surprising

curl.exe --help

Cause of an error :

  • After bit googling I found that this is something related to Aliases
  • curl and Invoke-WebRequest are aliases in PowerShell as shown in above error and this is the reason only curl command is not working but curl.exe is working

What are Aliases :

  • An alias is an alternate name or nickname for a cmdlet or for a command element, such as a function, script, file, or executable file.
  • We can use the alias instead of the command name in any PowerShell commands
  • We could get the list of all aliases in PowerShell by using Get-Alias PowerShell cmdlet as
Get-Alias

curl - Get-Alias cmdlet
Fig : curl – Get-Alias cmdlet

Solution :

  • There is an option – to remove alias for curl
  • We can use Remove-Alias cmdlet
  • Syntax for Remove-Alias cmdlet

Remove-Alias
      [-Name] <String[]>
      [-Scope <String>]
      [-Force]
      [<CommonParameters>]

  • Please note – Remove-Alias CMDLET is available PowerShell 6
  • If you have older version then please use CMDLET – Remove-Item
  • Syntax for Remove-Item
Remove-Item
      [-Path] <String[]>
      [-Filter <String>]
      [-Include <String[]>]
      [-Exclude <String[]>]
      [-Recurse]
      [-Force]
      [-Credential <PSCredential>]
      [-WhatIf]
      [-Confirm]
      [-Stream <String[]>]
      [<CommonParameters>]

curl - executing Remove-Item - Removing the alias for curl
Fig : curl – executing Remove-Item – Removing the alias for curl

Our other curl article – Microsoft 365 – resolving error : curl: (1) Protocol “‘https” not supported or disabled in libcurl – https://knowledge-junction.com/2021/12/04/microsoft-365-resolving-error-curl-1-protocol-https-not-supported-or-disabled-in-libcurl/

Thanks for reading 🙂 HAVE A GREAT TIME AHEAD 🙂

Prasham Sabadra

LIFE IS VERY BEAUTIFUL :) ENJOY THE WHOLE JOURNEY :) Founder of Knowledge Junction and live-beautiful-life.com, Author, Learner, Passionate Techie, avid reader. Certified Professional Workshop Facilitator / Public Speaker. Scrum Foundation Professional certificated. Motivational, Behavioral , Technical speaker. Speaks in various events including SharePoint Saturdays, Boot camps, Collages / Schools, local chapter. Can reach me for Microsoft 365, Azure, DevOps, SharePoint, Teams, Power Platform, JavaScript.

You may also like...

1 Response

  1. December 11, 2021

    […] curl – resolving error – curl : The remote name could not be resolved: ‘–help’ – https://knowledge-junction.com/2021/12/07/curl-resolving-error-curl-the-remote-name-could-not-be-res&#8230; […]

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: