Is there a way to read in the output of a 'dir' command into an array in a BAT file? Or would I need to output it to a file first, then read the file and delete the file after?
The purpose is to get a list of folders in a directory, append a number to each and then prompt the user for a numerical input to select a folder.
UPDATE : got it!
SETLOCAL EnableDelayedExpansion
SET /A c=1
FOR /F "tokens=*" %%F in ('dir /on /b /a:d /p %svnLOCAL%') DO (
ECHO !c!. %%F
SET dir_!c!=%%F
SET /a c=c+1
)
REM test array
ECHO !dir_4!
ENDLOCAL
Question&Answers:os