有人能告诉我为什么 - 或不起作用.如果我运行代码,第一个输出是管理员,它返回true但是当它到达kahuna帐户时它仍然返回false而不是true.
(Get-LocalUser).Name | Out-File C:\localusers.txt
ForEach ($User in Get-Content C:\localusers.txt)
{
If ($User -match "administrator" -or "kahuna")
{
Write-Host True
}
Else
{
Write-Host False
}
}
Run Code Online (Sandbox Code Playgroud)
我明白了
真,假,假,假,假
以下是按其显示顺序列出的帐户
管理员,DefaultAccount,Guest,Kahuna,PCUser
powershell ×1