Inside a batch file on Windows I would like some variable to have the output of dir /b command.
dir /b
How this can be achieved ?
@ECHO OFF setlocal enabledelayedexpansion set LF=^ rem ** The two empty lines are NECESSARY set output= FOR /F %%i in ('dir /b') do SET output=!output!!LF!%%i ECHO !output!