< "log.log" (for /f "delims=" %%a in ('dir *.txt /b /o:n') do (
set /p "var="
if defined var echo ren "%%a" "!var!%%~xa"
First, what's the use of the redirect output operator?
It is redirecting INPUT into the for loop. For each iteration of the for loop a line of the log.log text file is provided as input in the for loop.
The set /p "var="
command accepts this unusual form of input and you can use it inside the loop.
the set var=
command initialises the variable for various reasons. If there are more *.txt files than lines in log.log then the variable would otherwise remember the last line of input.
The FOR loop is inside a ()
This enables the use of redirecting input into the for in do loop.