你能跳到PowerShell高级功能的END块吗?

时间:2016-07-20 15:26:21

标签: powershell cmdlets cmdlet

在像

这样的示例函数中
function get-foo
{ 
    param ($name)
    BEGIN {#I'm checking for something like $name being true/false}
    PROCESS {#If $name is true I'll do something otherwise I want 
             to skip to END}
    END {#last stuff}
}

是否有一个实际的cmdlet要跳到结束块,或者我只需要创建一个if语句来检查变量并将其包裹在我的PROCESS块内部?像这样,

function get-foo
    { 
        param ($name)
        BEGIN {#I'm checking for something like $name being true/false}
        PROCESS {If ($name) {#If $name is true I'll do something otherwise I want to skip to END} }
        END {#last stuff}
    }

0 个答案:

没有答案