The question seems to be pretty easy, but I haven't found solution myself.
I have some folder, with 1 jpg-file inside it (foo bar.jpg) and this bat-file:
for /f %%f in ('dir /b /a:-d "*.jpg"') do echo "%%f" pause For some reason instead of something like this:
C:\Test>echo foo bar.jpg foo bar.jpg I see this:
C:\Test>echo "foo" "foo" Despite I already put %%f inside quotes.
I.e. command prompt doesn't understand the space in file name.
How to fix it?
(In my real code I will use copy instead of echo).