【发布时间】:2017-09-11 23:36:45
【问题描述】:
我有当前代码:
$installers = @{
"vagrant.msi" = "https://releases.hashicorp.com/vagrant/2.0.0/vagrant_2.0.0_x86_64.msi";
"chrome.exe" = "https://dl.google.com/tag/s/defaultbrowser/chrome/install/ChromeStandaloneSetup64.exe";
}
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
foreach ($i in $installers.GetEnumerator()) {
Start-Job -ScriptBlock {
Invoke-WebRequest $($using:i.Value) -Method Get -OutFile "$env:USERPROFILE\Downloads\$($using:i.Name)"
}
}
Get-Job|Wait-Job
我相信这应该同时将两个文件下载到 Downloads。这两项工作似乎都在运行,但最后我只得到了chrome.exe。
有谁知道我做错了什么?
【问题讨论】:
标签: windows powershell batch-file