这是新情况。我编写了以下脚本来下载最新版本的应用程序并进行安装,但它只处理第一个条目 innosetup[0]
$inno ="https://downloads.avs4you.com/distributives/AVSInstallPack.exe::https://download.xnview.com/XnView-win-full.exe::https://download.xnview.com/XnViewMP-win-x64.exe::https://download.xnview.com/XnConvert-win-x64.exe::https://downloads.ntlite.com/files/NTLite_setup_x64.exe::https://www.kymoto.org/downloads/ISStudio_Latest.exe" -split "::"
foreach($dlfrom in $inno){
#selects the application from said list
$dlfrom
#next section selects just the application name and creates the variable for the download destination
$i= $dlfrom -split '/'
foreach($_ in $i){
if($_.Contains('.exe')){
$dlto=$env:TEMP +'\'+ $_ }
}
#... and finally download the file
invoke-webrequest $dlfrom -OutFile $dlto
}
确实如此https://downloads.avs4you.com/distributives/AVSInstallPack.exe然后停止,但是当我仅让其 ECHO 结果时,它会处理整个数组。我做错了什么?
答案1
好的。我找到了一些可行的方法,但我不知道它为什么会起作用!如果能提供一个更清晰的例子就更好了!
$inno ="https://downloads.avs4you.com/distributives/AVSInstallPack.exe::https://download.xnview.com/XnView-win-full.exe::https://download.xnview.com/XnViewMP-win-x64.exe::https://download.xnview.com/XnConvert-win-x64.exe::https://downloads.ntlite.com/files/NTLite_setup_x64.exe::https://www.kymoto.org/downloads/ISStudio_Latest.exe" -split "::"
foreach($dlfrom in $inno){
$dlfrom
$i= $dlfrom -split '/'
foreach($_ in $i){
if($_.Contains('.exe')){
$dlto=$env:TEMP +'\'+ $_ }
}
$dlto
invoke-webrequest $dlfrom -OutFile $dlto
}