1.

Solve : How can I save output of dir in a variable??

Answer»

Hi all,

OUTPUT of DIR can be re-routed into myfile with "dir > myfile ".
How can I re-route it into a variable?

Thanks beforehand,
regards.You don't so much redirect output to a variable as to construct a variable from the pieces of the output.

Code: [Select]@echo off
for /f "delims=" %%a in ('dir c:\temp') do (
CALL set concat=%%concat%%%%a
)
echo %concat%

Be SURE to change the directory name.

Thank you, Sidewinder, very much.

You've solved all my problems, that I had with my batch file.

Best regards.



Discussion

No Comment Found