I am not familiar with batch script variable scoping. But I ran into scoping problem due to my lack of batch script experience.
for /f %%i in (\'dir /s /b \"%Fol
Again, EnableDelayedExpansion
:
setlocal enabledelayedexpansion
for /f %%i in ('dir /s /b "%FolderLocation%"') do (
For %%A in ("%%~i") do (
Set File=%%~nxA
echo !File!
)
:: This shows how "%" doesn't work but "!" does
Echo ^%File^%: %File% - ^!File^!: !File!
)
And that should work for you. Just remember to use !File!
inside a for-loop and %File%
outside.