0
簡單這裏腳本,以及至少我認爲它應該是,但我有最終結果的問題:if/else語句和複製項問題
$a = Get-Content "content\file\location"
$destfile = "destination\of\file"
$source ="source\file\location"
$dest = "c$\destination"
$destfolder = "c:\folder\destination"
foreach ($a in $a) {
if (Test-Connection $a -Count 1 -Quiet) {
if (Test-Path "\\$a\$destfile") {
Write-Host $a "File exists" -ForegroundColor Green
} else {
Write-Host $a "File is missing and will now be copied to $a\$destfolder" -ForegroundColor Red |
Copy-Item $source -Destination "\\$a\$dest"
}
}
}
的問題是,它從來沒有把文件拷貝,我哪裏做錯了?
感謝您的幫助提前。
完美運作。非常感謝你。一如既往的可以指望這個社區指出一個新手正確的補丁。感謝蘇打水。 – NuckinFutz