Dot-sourcing is the easiest option, although not very beautiful, as already mentioned. However, this format makes it a little cleaner:
$ScriptDirectory = Split-Path $MyInvocation.MyCommand.Path . (Join-Path $ScriptDirectory ScriptA.ps1)
In addition, a note on relative paths , which is useful for explicit: the original message may seem desirable for a path relative to the current working directory; in fact, the intent should relate to the current source directory of the script (as the alex2k8 native code example shows). Thus, this allows the current script to access other scripts from the same repository.
Michael Sorens Jun 02 '11 at 17:19 2011-06-02 17:19
source share