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#格化式
原文地址:https://www.cnblogs.com/hjbf/p/10721972.html