PowerShell's do until
loop is a looping construct that will repeat a block of code until a specified condition is met.
It's similar to the while
loop, but the condition is checked at the end of each iteration instead of at the beginning.
Here's an example of how you might use a do until loop in PowerShell:
$i = 0
do {
# This code will run until $i is greater than 5
$i++
Write-Host $i
} until ($i -gt 5)
In this example, the do until
loop will run until the value of $i
is greater than 5
.
On each iteration of the loop, the value of $i
is incremented by 1
, and the new value is printed to the screen using the Write-Host
cmdlet.
When the value of $i
is greater than 5
, the loop will stop and the script will continue to the next line of code.
PowerShell's do until
loop is a looping construct that will repeat a block of code until a specified condition is met.
Related tutorials curated for you
How to find the Windows version from the PowerShell command line
How to use SFTP in PowerShell
How to add a user to a group in PowerShell
How to use -filter in Get-ChildItem in PowerShell
Piping in PowerShell
How to rename a file in PowerShell
How to unzip a file in Powershell
How to order a hashtable in PowerShell
How to use String Contains in PowerShell
What is PowerShell logging?
How to use -Contains in PowerShell
What is PowerShell ExpandProperty?