# Do While loop
Do {
Write-Host "Online"
Start-Sleep 5
}
While (Test-Connection -ComputerName 8.8.8.8 -Quiet -Count 1)
Write-Host "Offline"
# While loop
$i = 0;
$path = "C:\temp"
While ($i -lt 10) {
# Do Something
$newFile = "$path\while_test_file_" + $i + ".txt";
New-Item $newFile
$i++;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter