我写了以下代码
$sb = {
. .\Myfunctions.ps1
$x = MyFunction1
$y = MyFunction2
$x + $y
}
$cred = Get-Credential "domain\user"
Invoke-Command -Computer localhost -Credentials $cred -ScriptBlock $sb
这不起作用,因为它说 The term .\MyFunctions.ps1 is not Recognized as commandlet
为什么我不能在脚本块中包含文件?