【发布时间】:2021-08-03 21:02:17
【问题描述】:
我才刚开始,所以我一定错过了一些东西。 下载每个文件都很好:我只是不知道如何附加到同一个输出文件。这是我目前拥有的。
Invoke-WebRequest -Uri "https://website.com/part1.bin" -OutFile "D:\stuff\bigfile.bin"
Invoke-WebRequest -Uri "https://website.com/part2.bin" -OutFile "D:\stuff\bigfile.bin"
Invoke-WebRequest -Uri "https://website.com/part3.bin" -OutFile "D:\stuff\bigfile.bin"
有什么建议吗?谢谢。
【问题讨论】:
-
也许您可以将结果通过管道传递给
Out-File -Path «wherever» -Append,而不是使用-OutFile? -
不确定您是否可以在二进制文件上使用
Out-File。也许最好将它们作为单独的部分下载,然后将它们作为字节加入内存中。 -
@JeffZeitlin - 谢谢,但我不知道该怎么做;能给我举个例子吗?
-
假设
Out-File将允许二进制数据,您将在第一部分使用Invoke-WebRequest -URI "https://website.com/part1.bin" | Out-File -Path "D:\stuff\bigfile.bin",对第二部分使用Invoke-WebRequest -URI "https://website.com/part2.bin" | Out-File -Path "D:\stuff\bigfile.bin" -Append(第三部分,适当更改URI)。
标签: windows powershell http scripting