Get only the IP Adress in Anaconda Powershell Get only the IP Adress in Anaconda Powershell curl curl

Get only the IP Adress in Anaconda Powershell


In Windows PowerShell, curl does not refer to the external curl.exe program; instead, it is a built-in alias for PowerShell's Invoke-WebRequest cmdlet.

In order to invoke curl.exe, include the filename extension, .exe:

curl.exe ipinfo.io/ip  # Note: The https:// part isn't strictly needed.

Note that this is no longer necessary in PowerShell (Core) v6+, where the curl alias has been removed, along with others, so as not to shadow external programs that come with the operating system.


Also note that you could also have used the Invoke-RestMethod cmdlet, which - unlike Invoke-WebRequest, which returns a wrapper object around the actual data - returns the response data directly (and, as applicable, parses XML data into [xml] instances and JSON data into [pscustomobject] instances); its built-in alias is irm:

irm ipinfo.io/ip  # irm == Invoke-RestMethod

As a general tip: To determine which command (a PowerShell-native one or an external program) a given name such as curl refers to, use the Get-Command cmdlet.

  • By default, the effective command by that name will be listed.
  • If you add the -All switch, you'll potentially see shadowed command forms.
    • On Windows, if an external program is shadowed, you can still invoke it by excluding the .exe extension, as shown.

    • Generally, if a shadowed command is of a different type than the effective command, you can use the Get-Command's -Type parameter to target the shadowed command and invoke it via &, the call operator; e.g., the (less desirable) alternative to appending .exe on Windows would be:

      & (Get-Command -Type Application curl) ipinfo.io/ip