In case the file your variable holds doesn't actually exist the FOR
approach won't work. One trick you could use, if you know the length of the extension, is taking a substring:
%var:~0,-4%
the -4
means that the last 4 digits (presumably .ext) will be truncated.