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