When a file, along with relative path or full path..., is given as a parameter of a batch, I know how to expand %1 to get the file name
%~n1
It's quite easy!
Nevertheless, I want to get the name of file from its relative/full path which is right handled inside the batch.
Please look at my code. I'd like to expand %%x (which is a relative path in my case) to take account only its file name. Please do you have any idea? Thanks
@echo off
SETLOCAL EnableDelayedExpansion
set currDir=%CD%
for /f "tokens=*" %%x in (Lists.out) do (
echo %%x
set filetxt=%%x)
Here's an example "Lists.out" file with some different files built-in relative paths. "Lists.out" can be made of
Temp\my file1_X
Temp\my file2_X
...............