当我在While内的第二个提示中回答“ n”时,为什么我下面的示例中的While循环为什么又从“写主机“没有数据库,请键入文件名””重新开始,而跳过了而封锁
有什么主意吗?
$GetDb = Get-SqlDatabase -name "Data1" -ServerInstance "server\insta"
if ($GetDb) {
Write-Host "Db exists!"
}
else {
Write-Host "No db, please type filenames"
$Prompt = Read-Host "Do you want add files?(y/n)"
While ($Prompt-match "y") {
$file1 = Read-Host "Type filename"
$Prompt = Read-Host "Do you want to add more files?"
}
}
谢谢
db