以下是感兴趣的文件(高度简化的版本):
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-func
替换为func-outer
,那么它就可以了。
我是Powershell和Workflows的新手,并且需要使用工作流程。有人可以解释一下这里有什么问题吗?