PowerShell中使用return语句退出函数例子
本文介绍在自定义PowerShell函数时,可以使用return语句来退出函数,同时return语句也可以返回值给函数的调用者。使用return语句来直接退出函数。看一个退出函数的例子:复制代码 代码如下:function Get-NamedProcess{ param ($name=$null) if ($name -eq $null) { Write-Host -ForegroundColor Red ‘Specify a name!" return ...