我在Windows 10的powershell中运行这个命令。
命令如下
Invoke-WebRequest -Uri www.example.com -Method POST -InFile FileNameHere
得到的错误是
+ Invoke-WebRequest -Uri "www.example.com ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest],WebExce
ption
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
我是初学者,所以我不知道到底是怎么回事。
需要为-ContentType
添加一个值。例如,
Invoke-WebRequest -Uri www.example.com -Method POST -ContentType 'text/plain' -InFile FileNameHere