Good morning,
I'm currently trying to read multiple directories, instead of using the given statement several times I want to iterate through the folders in a for loop.
Key data:
- current statement:
robocopy C:\Users\test\v2.5.0.0 C:\Users\enddir *.sql
- now i saw the following code example for a batch for loop
for /l %%x in (1, 1, 100) do ( echo %%x MY ROBOCOPY STATEMENT )
- The directories look somewhat like this
- v2.5.0.0
- v2.5.0.1
- v2.5.0.3
- v2.6.8.2
- v2.7.4.3
My idea is, to have 4 capsuled for loops to iterate through all directories so I'm able to use variables example: vW.X.Y.Z instead of v2.5.0.0
So, the point of my question is: how can i set and use a variable in a for loop so that it has the value of the current iteration? I'm used to java if that helps in explaining.
Thanks in advance for your help. :)
if there is some information missing, I'm happy to give more!
edit: code i think will work
for /l %%w in (1, 1, 100) do (
for /l %%x in (1, 1, 100) do (
for /l %%y in (1, 1, 100) do (
for /l %%z in (1, 1, 100) do (
robocopy C:\Users\test\v%%w.%%x.%%y.%%z C:\Users\enddir *.sql
)
)
)
)