I have the following batch script
@echo off
setlocal
set TEST_DIR="E:/img"
:: for all png files in TEST_DIR
for /r "%TEST_DIR%" %%f in (*.png) do (
:: print file full path
echo TESTING %%f
:: store the path into MY_VAR
set MY_VAR=%%f
:: print MY_VAR (always blank!?)
echo TESTING %MY_VAR%
)
endlocal
The printing of MY_VAR always is blank. Why is that?
If the img directory contains 2 png files: - img1.png - img2.png
then here is the output from the console:
E:\img>test.cmd
TESTING E:\img\img1.png
TESTING
TESTING E:\img\img2.png
TESTING
Thanks