for substring
Here is how you extract the various elements from a fully qualified file name:
@echo off
set my_file=C:\path\to\dir\test.xls
for /F %%a in ('echo %my_file%') do (
echo Drive=%%~da
echo Path=%%~pa
echo Name=%%~na
echo Extension=%%~xa
)