Dot Source with Join-Path

220 Views Asked by At

Is it possible to dot source a path with join-path?

Example

With MASTER.ps1 I invoke CHILD.ps1

MASTER Lives in C:\Folder

CHILD Lives in C:\Folder\Sub

MASTER.ps1
$FooBar = 'Cheese'
"C:\Folder\Sub\CHILD.ps1 " | Invoke-Expression


CHILD.PS1

. (Join-Path $PSScriptRoot\..\ 'MASTER.ps1')
Write-Output "$FooBar"


Things I tried
    . (Join-Path $PSScriptRoot\..\ 'MASTER.ps1')
    . (Join-Path $PSScriptRoot "\..\MASTER.ps1")
    . (Join-Path "$PSScriptRoot\..\MASTER.ps1")
    . (Join-Path "$PSScriptRoot\..\" 'MASTER.ps1')
0

There are 0 best solutions below