I am using the following code, and if I call the array.bat outside loop, you can the the value in output that is different, varying with the index that I used during call.
@echo off
set empresas[0]=EPB
set empresas[1]=ENF
set empresas[2]=ESE
set empresas[3]=ESS
set empresas[4]=EBO
set empresas[5]=EMG
set empresas[6]=EMT
set empresas[7]=ETO
call array.bat len empresas length
call array.bat getitem empresas 0 empresa1
echo %empresa1%
call array.bat getitem empresas 1 empresa1
echo %empresa1%
echo %length%
for /l %%x in (0, 1, %length% ) do (
call array.bat getitem empresas %x% empresa3
echo %empresa3%
echo %%x
)
That code generate the output:
EPB
ENF
7
ETO
0
ETO
1
ETO
2
ETO
3
ETO
4
ETO
5
ETO
6
ETO
7
Only tha last value is being printted.