How to use nested FOR loops in batch files
I have some code in which I want to use a FOR loop to handle a set of files. As part of handling a file there's a FOR /F loop that reads it and appends data to an other file based on the file name. In order to be able to set the output file name I have delayed variable expansion set on. This is what the code should look like as I originally intended it to be: setlocal enabledelayedexpansion for %%f in (DataFolder\*.Ext) do ( set POI=%%~f set POI=!JbPOI:DataFolder\=! set POI=!JbPOI:.Ext=! for /f "tokens=1,2,3 delims=," %%a in ("%%~f") do ( set CX=%%a set CY=%%b set FN=%%c echo !FN!,9,!CX!,!CY!