我在目录中有以下脚本c:\scripts\
。
# . c:\scripts\anotherScript.ps1
function GetScriptRoot { Split-Path $script:MyInvocation.MyCommand.Path }
. "$(GetScriptroot)\anotherScript.ps1"
但是,它会在 ISE 中引发错误。这是一种在控制台和 ISE 中都适用的方式吗?我试图不使用完整的绝对路径。
我在目录中有以下脚本c:\scripts\
。
# . c:\scripts\anotherScript.ps1
function GetScriptRoot { Split-Path $script:MyInvocation.MyCommand.Path }
. "$(GetScriptroot)\anotherScript.ps1"
但是,它会在 ISE 中引发错误。这是一种在控制台和 ISE 中都适用的方式吗?我试图不使用完整的绝对路径。