SyntaxFix
Write A Post
Hire A Developer
Questions
There's a handy .NET method for that:
C:\PS> [io.path]::GetFileNameWithoutExtension("c:\temp\myfile.txt") myfile