I would like to call script B from script A without specifying the complete path. I've tried with
.\scriptb.ps1
but that doesn't work. Do I really have to specify the entire path?
(sorry for this quite basic question, but google couldn't help me!)
it is possible using $MyInvocation
as follows:
$executingScriptDirectory = Split-Path -Path $MyInvocation.MyCommand.Definition -Parent
$scriptPath = Join-Path $executingScriptDirectory "scriptb.ps1"
Invoke-Expression ".\$scriptPath"