如果else语句在使用PowerShell的其他方面不起作用 [英] If else statement is not working in else side using powershell

查看:97
本文介绍了如果else语句在使用PowerShell的其他方面不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

I use if else in my powershell script. in the if side, it works, but in the else side, It cannot return "Not Found" . It does not show any error.





我尝试过:





What I have tried:

if ($match.Groups.Count) {
    while ($match.Success) {
        Write-Host ("Match found: {0}" -f $match.Value)
        $match = $match.NextMatch()
    }
}
else {

    Write-Host "Not Found"
}

推荐答案

match.Groups.Count){
while(
match.Groups.Count) { while (


match.Success){
Write-Host(匹配找到:{0} - f
match.Success) { Write-Host ("Match found: {0}" -f


match.Value)
match.Value)


这篇关于如果else语句在使用PowerShell的其他方面不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆