I am attempting to store the return of a dir
command into a variable. So far all I've found requires a for /f
loop. This call is made from within another for /f
loop and I am having issues with it. Here are snippets for the relevant parts of the code:
set "list=list.txt"
setlocal enabledelayedexpansion
for /f "tokens=*" %%D in (%list%) do (
set "path_to=%%D"
...
...
...
for /f "delims=" %%Z in ('dir /b "%path_to%\..\..\.." | find /c /v ""') do (echo %%Z)
)
I am using %path_to%
instead of !path_to!
because the variable is outside of this second for loop.