Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Показать сообщение отдельно

Ветеран


Сообщения: 27449
Благодарности: 8087

Профиль | Отправить PM | Цитировать


obseoe, а зачем такое неудобное использование:
Цитата obseoe:
$A0="\\fs03\inst0\123.exe"
$A1="\\fs03\inst1\123.exe"
$A2="\\fs03\inst2\123.exe"
и так далее для A »
?! Почему не массив?

Код: Выделить весь код
$sSourceFile = "\\fs03\Distrib\123.exe"
$aDestPaths  = "\\fs03\inst0", "\\fs03\inst1", "\\fs03\inst2"

if(Test-Path -Path $sSourceFile -PathType Leaf) {
    $aDestPaths | ForEach-Object -Process {
        if(Test-Path -Path $_ -PathType Container) {
            Copy-Item -Path $sSourceFile -Destination $_ -Force
        } else {
            Write-Host "Can't find destination path [$_]" -ForegroundColor Red
        }
    }
} else {
    Write-Host "Can't find source file [$sSourceFile]" -ForegroundColor Red
}
Это сообщение посчитали полезным следующие участники:

Отправлено: 14:41, 21-02-2014 | #4