相关疑难解决方法(0)

括号Powershell函数

如何使用带括号的powershell中的参数调用函数.

我有这个功能的例子

function Greet([string]$name , [int]$times)
{
    for ([int]$i = 1; $i -le $times;$i++)
    {
        Write-Host Hiiii $name
    }
}
Run Code Online (Sandbox Code Playgroud)

如果我使用Greet Ricardo 5Greet "Ricardo" 5工作调用函数 .但是当我使用Greet ("Ricardo",5)Greet("Ricardo" ; 5)它失败时.

怎么了?

powershell function

4
推荐指数
1
解决办法
3249
查看次数

标签 统计

function ×1

powershell ×1