windows - why in batch script do not working the "do set" function? -


i have following problem in batch scripting.

i have code lines

for /f "tokens=*" %%d in ('dir /b /s a2lfiles_merger*.txt') set merger_list=%%d echo %merger_list% 

and result echo off

then tried code

for /f "tokens=*" %%d in ('dir /b /s a2lfiles_merger*.txt') echo %%d 

the result c:\users\user\desktop\build\input\job_1\a2lfiles_merger.txt

so, question why cannot set variable path? need use in next steps , stuck in situation. can find solution ? thank in advance!

revised code:

    setlocal enabledelayedexpansion     /f "tokens=*" %%d in ('dir /b /s a2lfiles_merger*.txt') ( set merger_list=%%d     echo !merger_list! ) 

note setlocal command , parenthesis enclosing commands executed in for-loop. that's how loops work.

hope helped!


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -