I have multiple variables containing file paths
set path[1]=\\192.168.0.20\Test1
set path[2]=\\192.168.0.20\Test2
set path[3]=\\192.168.0.20\Test
Now I want to have a loop running that performs some operations with one path at a time. So in theory i want a variable inside a loop, lets call it "currentPath" that changes at each iteration.
Here is my go at it:
setlocal enabledelayedexpansion
for /l %%n in (1,1,%iP%) do (
echo !path[%%n]!
set currentPath=!path[%%n]!
echo variable:%currentPath%
net use %currentPath% /user:%hbmUser% %hbmPW%
)
The output however is not what I was looking for (for the first iteration):
\\192.168.0.20\Test1
variable:
and "net use" is of course not working since the variable is empty... Since the first echo is working I have no idea why I cant get the currrentPath variable to change to the new value... what am I doing wrong?