Reputation: 51
I've a really simple problem, but i dont get it working. I have a loop which checks if one of two possible files is existing, if not then sleep and check again in two seconds.
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
}
If I check both conditions in the same loop it checks only the first one.
Would be great if anybody can help
Regards, Justin
Upvotes: 0
Views: 23724
Reputation: 31
An interpretaion of David Brant worked for me:
while (!(Test-Path -Path $terminationFile) -or !(Test-Path -Path $noFile)) {
Start-Sleep 2
}
Upvotes: 3