That returns $null if the filename already has no extension. $gettok(string,1--2,46) would do it, but then it gets messy if you have a longfilename where the folder contains a period but the filename doesn't, so you'd need to use $nofile and $nopath, strip the extension, then join them back together.