我所要做的就是看用户输入$ month是否在数组$ month中。但它不喜欢什么。帮帮我?- 包含运算符不工作powershell
Write-host "The script is to collect from the user High Tempature and Low Tempature for a day in degrees F."
$months = @("January", "February","March","April","May","June","July","August","September","October","November","December")
$finished = $false
while ($finished -eq $false){
$month = read-host "Enter the month";
if ($months -Contains $month)
{
write-host "Invalid entry"
$finished = $false
}
else
{
$finished = $true
}
}
那么,这是工作,测试不是好的? – JPBlanc 2015-04-01 03:25:16
@JPBlanc它的工作原理是,如果他做得对,是的,但是他不会遇到大小写敏感问题?或者 - 是否包含大小写不敏感? – TheMadTechnician 2015-04-01 03:41:27
'CContains'区分大小写,而不是'Contains'。 – JPBlanc 2015-04-01 03:44:50