I am trying to get files from folders in batch. And this is the whole batch file:
for %%i in (folder) do echo (for /r "%%~i" %%j in (*.png) do echo %%~i-%%j)
The code executes as intended and outputs to console:
(for /r "folder" %j in (*.png) do echo folder-%j)
If i copy this and paste it as is to a cmd at the same path it echoes my file.
But if i remove the first echo from batch it outputs:
(for /R "%~i" %j in (*.png) do echo folder-%j )
Note that it doesn't execute the for loop and the second %%i is expanded but first is not. I can't get why this extremely basic one line batch doesn't work. Any help is appreciated.