@EXECARRAY[array,command] : Execute the specified command and store the resulting lines in the specified array variable. The array must be one-dimensional.

 

You must define the array before running @EXECARRAY. For example:

 

setarray aresult[10]

echo %@execarray[aresult,dir /u] >& nul

 

@EXECARRAY will read the number of lines specified in the array size definition, or the number of lines in the command output (whichever is less). @EXECARRAY returns the return value of the command.

 

The number of lines stored in the array is saved in the _EXECARRAY internal variable.