How to store the result of a command expression in a variable using bat scripts?

set cmd="dir /b "20??????" | find /c "2" "

FOR /F "tokens=*" %%i IN (' %cmd% ') DO SET X=%%i

Leave a Comment