To update a variable in a for loop in Windows batch script we need to call subroutines. Here is an example script that concatenates all .txt filenames to a variable using Windows CMD.
@echo off
rem List and concatenate all .txt filenames to a variable
set files=
for /f %%F in ('dir /B *.txt') do call :concat %%F
echo %files%
goto :eof
:concat
set files=%files% %1
goto :eof
See more at: http://ss64.com/nt/ and http://stackoverflow.com/questions/2027070/batch-file-string-concatenation
No comments :
Post a Comment