我必須在這裏失去了一些基本的東西,但我是新來的PowerShell ...呼叫/模塊中的一個函數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
我打算在一個模塊中有多個函數,但這是我所處的位置。
在此先感謝
看起來不對,也許是某個地方的錯字......導入模塊後,運行Get-Module userselectionlist和Get-Item FunctionSelectList的結果是什麼? – latkin
Get-Module UserSelectionList產生:PS L:\ Support Downstream \ Solarc \ CNGL \ Powershell腳本> Get-Module users選擇列表 ModuleType名稱導出命令 ---------- ------ ----------- 腳本userselectionlist {} – codeputer
Get-Item功能:錯誤與「無法找到路徑」功能:\ UserSelectionList',因爲它不存在。「 – codeputer