Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

MyInvocation.MyCommand problems

$
0
0

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=()


Viewing all articles
Browse latest Browse all 2562

Trending Articles