【发布时间】:2018-03-31 12:56:33
【问题描述】:
我现在已经没有办法了……
尝试 1
在 Powershell 中使用 iwr。它可以工作,显示进度,但速度慢 10 倍,并且直到文件在内存中时才会刷新:(。
powershell -command "& { iwr https://github.com/mitchellspryn/AirsimHighPolySuv/releases/download/V1.0.0/SUV.zip -OutFile SUV.zip }"
尝试 2
在 Powershell 中使用 .Net 网络客户端。它可以工作,但没有任何进展,你不能通过 Ctrl+C 终止:(。最后一个问题是一个很大的挫折。
powershell -command "& { (New-Object System.Net.WebClient).DownloadFile('https://github.com/mitchellspryn/AirsimHighPolySuv/releases/download/V1.0.0/SUV.zip', 'SUV.zip') }"
尝试 3
在 Powershell 中使用 BITS 传输。它可以工作,显示进度并且几乎完美...直到您发现它mysteriously doesn't work on GitHub(禁止出现 403 错误)!!
powershell -command "& { Start-BitsTransfer -Source https://github.com/mitchellspryn/AirsimHighPolySuv/releases/download/V1.0.0/SUV.zip -Destination SUV.zip }"
【问题讨论】:
-
为什么要单独运行
powershell.exe(powershell.exe -command ...)?只需直接从 PowerShell 命令行运行您需要的命令。 -
我正在从另一个构建脚本中使用它,现在将整个脚本转换为 PS 不是我们的目标。
-
我今天在 github 资产上尝试了
Start-BitsTransfer,它成功了。 (甚至尝试过你的)。现在这有可能像你想要的那样在 Github 上运行吗?
标签: powershell command-line webclient-download microsoft-bits