我有一个非常简单的问题,但我没有让它发挥作用。我有一个循环,它检查两个可能的文件中是否有一个存在,如果没有,那么睡眠并在两秒钟内再次检查。
while (([System.IO.File]::Exists($terminationFile) -ne $true) -or ([System.IO.File]::Exists($noFile) -ne $true)) {
# wait 2 seconds and check again
Start-Sleep -s 2
}
如果我在同一个循环中检查两个条件,它只会检查第一个条件。
如果有人可以提供帮助,那就太棒了
此致 贾斯汀
答案 0 :(得分:0)
对David Brant的解释对我有用:
while (!(Test-Path -Path $terminationFile) -or !(Test-Path -Path $noFile)) {
Start-Sleep 2
}