小编pet*_*rot的帖子

为什么脚本化cmdlet列为函数?

如果我创建一个简单的Powershell函数,例如

Function Hello {
    [CmdletBinding( )]
    Param (
        [parameter()]
        $Name
    )
    Begin{}
    Process{
        Write-Output "Hello $Name"
    }
    End{}
    }
Run Code Online (Sandbox Code Playgroud)

然后使用Get-Command列出它Get-Command Hello,cmdlet被列为'CommandType'函数.为什么不将它列为'CommandType'cmdlet?

从模块导出时,我还发现我必须使用FunctionsToExport而不是CmdletsToExport.

它似乎并没有影响功能的使用,我只是好奇他们为什么这样列出.

powershell cmdlets function

15
推荐指数
1
解决办法
4014
查看次数

标签 统计

cmdlets ×1

function ×1

powershell ×1