我一定在这里遗漏了一些基本的东西,但我是 powershell 的新手......
我写了一个函数并将其保存在一个名为“UserSelectionList.psm1”的文件中,该函数是这样的:
function Global:UserSelectionList([String[]] $UserOptions)
{
...
}
Run Code Online (Sandbox Code Playgroud)
然后我尝试用这个脚本调用它:
Import-module "l:\support downstream\solarc\cngl\powershell scripts\userselectionlist.psm1"
$Options = "a","b","c"
cls
$result = UserSelectionList $Options
echo $result
Run Code Online (Sandbox Code Playgroud)
由此产生的错误是:
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
Run Code Online (Sandbox Code Playgroud)
我计划在一个模块中拥有多个功能,但这就是我所处的位置。
提前致谢
| 归档时间: |
|
| 查看次数: |
19428 次 |
| 最近记录: |