Do Until循环错误

时间:2012-12-27 21:28:27

标签: powershell

do{
$ActionVariable = Read-host "Do you want to delete a folder or empty a folder ? [D/E]"
}
until($ActionVariable = "E" -or"D") 

Read-host

您好,我正在尝试编写一个脚本,让用户可以选择清空文件夹或将其整体删除。我写了一个do until循环似乎没有起作用。我是否定义了直到错误?

1 个答案:

答案 0 :(得分:4)

这应该更好:
until ($ActionVariable -eq 'E' -or $ActionVariable -eq 'D')

或者也许这样:
until ('E','D' -contains $ActionVariable)

相关问题