Invoke-RestMethod:无法为不写入数据

时间:2015-12-23 11:34:14

标签: powershell-v4.0

我在powershell中寻找cURL等效命令,然后找到下面提到的URL:

https://superuser.com/questions/344927/powershell-equivalent-of-curl

根据上面的网址,我在拥有Powershell 4.0版的系统中尝试了下面提到的powershell脚本

Invoke-RestMethod -Uri www.discoposse.com/index.php/feed -Method Get -OutFile C:\Temp\DiscoPosseFeed.xml

一旦我运行上面的命令,我在指定的位置看到一个xml文件但是现在我指定了如下所述的编码:

Invoke-RestMethod -Uri www.discoposse.com/index.php/feed -TransferEncoding compress  -Method Get -OutFile C:\Temp\DiscoPosseFeed.xml

我收到错误:

enter image description here

任何人都可以帮助我知道我在这里缺少什么吗?

1 个答案:

答案 0 :(得分:0)

解释是你的命令行没有在行上写任何东西。 TransferEncoding指定传输编码HTTP响应标头的值。有效值为Chunked,Compress,Deflate,GZip和Identity。