DBremen
9/2/2015 - 12:45 PM

Example on how to wait for a window to appear for an executable initiated from PowerShell

Example on how to wait for a window to appear for an executable initiated from PowerShell

$regeditInstance = [Diagnostics.Process]::Start("regedit","-m")
#wait the regedit window to appear
while ($regeditInstance.MainWindowHandle -eq 0){
    sleep -Milliseconds 100
}