powershell 函数, foreach中格式化

 

 

function testArg
{
    $n = 1;
    if($args.Count -eq 0)
    {
        "No arg!"
    }
    else
    {
        $args | foreach {"the {0} param is {1}" -f $n++,  $_ }
    }
}

-f 使用c#格化式

 

posted @ 2019-04-17 10:37  乘于时  阅读(649)  评论(0编辑  收藏  举报