I have a function:
function foo {
param (
[Parameter(ValueFromPipeline = $true)]
[System.IO.DirectoryInfo[]]$path
)
foreach ($p in $path) {
Write-Host $p.FullName
}
}
where '.' refers to the script's home directory instead of current directory.
PS D:\> foo .,"$pwd"
D:\ps1
D:\
I want foo .
returns D:\
instead of D:\ps1
, where the current directory is.