0
set CSS_FOLDER_SOURCE=.\css
set JS_FOLDER_SOURCE=.\js



for %%A in (JS, CSS ) do (

    if defined %%A_FOLDER_SOURCE (
        echo  %%%A_FOLDER_SOURCE%%
    )
)

I want to read the contents of both folders. But don't know how to dynamically generate the FOLDER_SOURCE names

user3733648
  • 1,323
  • 1
  • 10
  • 25
  • Possible duplicate of [How would I call a dynamic variable name?](http://stackoverflow.com/questions/22621708/how-would-i-call-a-dynamic-variable-name) – wOxxOm Oct 27 '15 at 15:11
  • If this duplicate is okay I'll delete my answer as unnecessary. – wOxxOm Oct 27 '15 at 15:11
  • You may review the details of this management at http://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990 – Aacini Oct 27 '15 at 15:13

1 Answers1

2

Use Delayed expansion:

setlocal enableDelayedExpansion

............
for %%A in (JS CSS) do (
    echo !%%A_FOLDER_SOURCE!
)
wOxxOm
  • 65,848
  • 11
  • 132
  • 136