directory に次のスクリプトがありますc:\scripts\
。
# . c:\scripts\anotherScript.ps1
function GetScriptRoot { Split-Path $script:MyInvocation.MyCommand.Path }
. "$(GetScriptroot)\anotherScript.ps1"
ただし、ISE でエラーが発生します。コンソールと ISE の両方で機能する方法ですか? 完全な絶対パスを使用しないようにしています。