I am new to batch programming. I need to traverse through all files in a directory, get the filename, assign it to a variable and then call a subroutine to perform a task. I am stuck in the first task of assigning filename to a variable. My code displays the file names correctly here
@echo off
for /R %%f in (*.*) do (
echo %%~nf
)
when I assign the name to a variable, only one value gets printed.
@echo off
for /R %%f in (*.*) do (
set xFilename=%%~nf
echo %%xFilename
)
I am missing some basic concept here. Please help.