I have a problem witch .bat file I have somethis like this:
@echo off
setlocal EnableDelayedExpansion
set arr[a]=1
set arr[b]=2
for /F "tokens=*" %%a in (somefile.txt) do (
set key=a
echo /!key!/ /!arr[%key%]!/
)
And code above not work correctly. I mean that the key is display correct but value of !arr[%key%]! is empty (i don't know why).
When i try it like this:
@echo off
setlocal EnableDelayedExpansion
set arr[a]=1
set arr[b]=2
set key=a
for /F "tokens=*" %%a in (somefile.txt) do (
echo /!key!/ /!arr[%key%]!/
)
Code above work good. No idea why first code doesn't work and second work. Any ideas ?