windows - cURL 无法识别命令行参数 (Windows 10)
问题描述
不确定我做错了什么,但是我尝试传递给 curl 的任何命令行参数(使用双破折号)都被解释为 url。运行curl --help
:
curl : The remote name could not be resolved: '--help'
At line:1 char:1
+ curl --help
+ ~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc
eption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
使用单个破折号似乎可以解释 url 参数,但它没有找到某些参数。运行curl -sSL
:
Invoke-WebRequest : A parameter cannot be found that matches parameter name 'sSL'.
At line:1 char:6
+ curl -sSL
+ ~~~~~
+ CategoryInfo : InvalidArgument: (:) [Invoke-WebRequest], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
从https://curl.se/windows/下载的 curl 二进制文件
解决方案
您可以在这里找到答案:通过 powershell 运行 curl - 如何构造参数?
“在 PowerShell 中,curl 是 Invoke-WebRequest cmdlet 的内置别名。别名在命令解析中具有优先权。要解决您的问题,请更具体地说,使用 curl.exe 而不是 curl,因此命令不会解析为别名”
推荐阅读
- git - Find out if integration branch contains tip of local branches
- javascript - 比较两个数组并追加到新数组
- active-directory - No SYSVOL or NETLOGON shares created after fresh install
- ios - VIPER design pattern in Swift configuring view
- java - IntelliJ IDEA jshell_console 重建项目后仍然报错
- javascript - ngrx on dispatching an action is it possible to not trigger the associated effect?
- javascript - 将检查从复选框传递到控制器
- javascript - 将 CSV 文件中的数据导入 HighCharts
- python - How to communicate with Excel files via subprocess using python?
- css - Image stretching due to AMP