Well, there's always this:
(split-path $path.ps1 -leaf).split(".")
Not terribly unreasonable, but I agree that a noExtension would be
nice, and actually, expected.
On Apr 9, 11:55 am, "Keith Hill [MVP]"
> This is one area where I think Korn shell is easier - determining the basename of a script san path and extension.
> SCRIPTNAME=$(basename $0 .ksh)
> versus the PowerShell way:
> $ScriptName = [system.io.path]::GetFilenameWithoutExtension($MyInvocation.InvocationName)
> What I would like to see is something like this:
> $ScriptName = Split-Path $MyInvocation.InvocationName -leaf -noExt
> It's not dramaticall fewer characters to type however you don't have to drop down to the .NET framework to strip an extension off a filename.