0

以下是感兴趣的文件(高度简化的版本):

main-func.psm1

function main-func
{
    [CmdletBinding()]
    param 
    ()

    Write-Verbose "In main-func"
    main-workflow
}

workflow main-workflow
{
    [CmdletBinding()]
    param 
    ()

    Write-Verbose "In main-workflow"
    func-outer
}

function func-outer
{
    [CmdletBinding()]
    param
    ()

    Write-Verbose "In func-outer"
    func-inner
}

function func-inner
{
    [CmdletBinding()]
    param
    ()

    Write-Verbose "In func-inner"
}

Export-ModuleMember -function main-func

现在我打开 Windows Powershell 并执行以下命令:

> Import-Module .\main-func.psm1
> main-func -Verbose

我得到的输出如下:

VERBOSE: In main-func
VERBOSE: [localhost]:In main-workflow
VERBOSE: [localhost]:In func-outer
The term 'func-inner' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a
path was included, verify that the path is correct and try again.
    + CategoryInfo          : ObjectNotFound: (func-inner:String) [func-outer], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException,func-outer
    + PSComputerName        : [localhost]

但是,如果我用 替换main-workflow函数main-funcfunc-outer那么它可以工作。

我对 Powershell 和 Workflows 还很陌生,并且需要使用工作流。有人可以解释这里有什么问题吗?

4

0 回答 0