因为Bitsadmin已被弃用,我想听听您是否知道从批处理脚本中下载文件的替代方法。 最好的是Windows已经附带的替代品,所以我不需要下载额外的东西。
答案 0 :(得分:5)
培根比特和我同时有同样的想法。以下是使用PowerShell的BitsTransfer
模块的示例。将其另存为.bat文件并运行它。
@echo off
setlocal
set "URL=http://cdn.sstatic.net/stackoverflow/img/sprites.svg"
set "SaveAs=sprites.svg"
powershell "Import-Module BitsTransfer; Start-BitsTransfer '%URL%' '%SaveAs%'"
答案 1 :(得分:2)
BITSAdmin.exe
的最佳替代方法是use PowerShell。
如果您无法使用PowerShell,那么您几乎会遇到copy
,xcopy.exe
和robocopy.exe
。
答案 2 :(得分:2)
好消息-BitsAdmin尚未被弃用。
(我在Microsoft的BITS团队工作)
答案 3 :(得分:1)
How can I download a file with batch file without using any external tools? - 您可以查看
PowerShell可能是最好的选择虽然你仍然可以找到没有PowerShell的vista和XP机器 - 如果可移植性对你来说很重要 去WSH。
。我不认为MSXML2.XMLHTTP和WinHTTPRequest(here I've a little bit more powerful tool based on winhttprequest - 以及更多测试版)将很快被弃用,但它们将需要WSH或jscript或vbscript或powershell。
jscript.net和webclient可以更好地处理更大的文件。