Dimlo powershell do while loop burp.

Soldato
Joined
8 Mar 2005
Posts
3,869
Location
London, UK
Being a being a bit of a cack-handed thicko here with a do loop with two conditions.
Code:
        $Timer = get-Date
        do
        {
        
        $Codeexecutedsuccessfully = 0
        <CODEBLOCK>
        $Codeexecutedsuccessfully = 1

        }
        while (((Get-Date).AddMinutes(-1) -le $Timer) -or ($Codeexecutedsuccessfully -eq 0))
My expectation is that the loop will break if either condition becomes false. However, the second condition is seemingly never met and the codeblock simply repeats for 60 seconds and meets the first condition.

ta, Paul.
 
Back
Top Bottom