Ich bin neu bei Powershell und ich brauche etwas Hilfe, um meinen Code zu beenden. Alles ist in Ordnung, aber ich brauche auf ELSE gehen Sie zurück, um eine Schleife zu tun. Wie kann ich das lösen?Powershell Do Loop
DO {
$getinfo=Get-Content $wblogpath | Select-Object -last 1
Write-Host -NoNewline "."$counter
Start-Sleep -s 1
$counter++
}
WHILE ($getinfo -notlike '*ReadyToRun->Run*' -and
$getinfo -notlike '*test*' -and
$getinfo -notlike '*error*' -and
$counter -le 8)
IF ($getinfo -like '*ReadyToRun->Run*')
{
Write-Host "`nREADY TO RUN"
}
ELSEIF ($getinfo -like '*test*')
{
Write-Host "`ntest"
}
ELSEIF ($getinfo -like '*error*')
{
Write-Host "`nerror"
}
ELSE{
Write-Host "`nRESTARTing WINBASIS"
$counter=0
}
Thanks :)
Kurze Antwort: unmöglich. Powershell kann nicht zwischen den Zeilen springen wie VBS. Sie müssen einen Weg finden, Ihre Bedürfnisse in Ihrem Do-while-Ausdruck zu erfüllen. – restless1987
Mögliches Duplikat von [Springen zu bestimmten Stellen im Skript] (http://stackoverflow.com/questions/20221565/jumping-around-to-certain-spots-in-script) – TessellatingHeckler