我必须在这里遗漏一些基本的东西,但我是powershell的新手......
我编写了一个函数并将其保存在一个名为“UserSelectionList.psm1”的文件中,该函数的存根如下:
function Global:UserSelectionList([String[]] $UserOptions)
{
...
}
然后我尝试用这个脚本调用它:
Import-module "l:\support downstream\solarc\cngl\powershell scripts\userselectionlist.psm1"
$Options = "a","b","c"
cls
$result = UserSelectionList $Options
echo $result
产生的错误是:
The term 'UserSelectionList' 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.
At line:5 char:28
+ $result = UserSelectionList <<<< $Options
+ CategoryInfo : ObjectNotFound: (UserSelectionList:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我计划在一个模块中拥有多个功能,但这就是我所在的地方。
提前致谢