If I write a script Test1.ps which has following 2 lines
$dir = split-path -parent $MyInvocation.MyCommand.Definition
echo $dir
it works fine. but I change it to
function GetPath() {
$f = split-path -parent $MyInvolcation.MyCommand.Definition
$f
}
$dir = GetPath
Write-Host $dir
it gets me a blank.
Very Annoying!!!!
val it: unit=()