Forum Discussion
Audi86
Aug 24, 2022Brass Contributor
Add a line to skip or continue loop execution
Hi I have a PS script which is terminating workflows in SharePoint. I don't want to run this script in one go rather I want to add user intervention as well. Below is my script portion. In line 44, I...
- Aug 25, 2022If you want to skip to the next loop iteration, without existing the loop/script, use the continue statement: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_continue?view=powershell-7.2
farismalaeb
Aug 25, 2022Steel Contributor
Do{
$Confirmation = Read-Host -Prompt "Are you sure (y/n)?"
if ($Confirmation -like "y"){write-host "The user says Yes" -ForegroundColor Green}
if ($Confirmation -like "n"){write-host "The user says No" -ForegroundColor red;Return}
}
while ($Confirmation -ne "y")
Write-Host "The Other code"