Reputation:
do{
$ActionVariable = Read-host "Do you want to delete a folder or empty a folder ? [D/E]"
}
until($ActionVariable = "E" -or"D")
Read-host
Hello, I am trying to write a script that lets a user choose to empty a folder or delete it as a whole. I wrote a do until loop that does not seem to function. Am I defining the until wrong ?
Upvotes: 1
Views: 6134
Reputation: 10337
This should work better:
until ($ActionVariable -eq 'E' -or $ActionVariable -eq 'D')
Or perhaps this:
until ('E','D' -contains $ActionVariable)
Upvotes: 4