cURL in power shell windows 8.1: “A drive with the name 'localhost' does not exist”

后端 未结 2 1687
终归单人心
终归单人心 2021-01-05 00:27

I was testing some nodejs server code and wanted to test the urls from windows power shell using the curl command. Some things to note here: 1. I have mingw and git bash ins

相关标签:
2条回答
  • 2021-01-05 00:48

    It looks like you already have curl as an alias to Ivoke-WebRequest:

    Invoke-WebRequest : A parameter cannot be found that matches parameter name 'X'.

    Try running remove-item alias:\curl and see if you now get the right curl being invoked. Alternatively, try by specifying the absolute path, i.e. c:\curl\curl.exe ....

    0 讨论(0)
  • 2021-01-05 01:15

    Since I updated to PowerShell 4.0, an Alias was created to point to Invoke-WebRequest with the name of curl, so what I've done is I added my own alias to the curl.exe executable I want to use instead:

    set-alias mcurl "C:\cygwin\bin\curl.exe"
    

    Powershell 4.0

    Get-Alias curl

    CommandType Name ModuleName ----------- ---- ---------- Alias curl -> Invoke-WebRequest

    My new Alias:

    Get-Alias mcurl

    CommandType Name ModuleName ----------- ---- ---------- Alias mcurl -> curl.exe

    0 讨论(0)
提交回复
热议问题