0

I am trying to set info from the array using second variable to recieve data from array

I can echo this (like this):

call echo %%line[%i%]%%

But cant use it to set variable (I try this):

set content=%%line[%i%]%%
dauzduz TV
  • 69
  • 7
  • [Arrays, linked lists and other data structures in cmd.exe (batch) script](https://stackoverflow.com/questions/10166386/arrays-linked-lists-and-other-data-structures-in-cmd-exe-batch-script/10167990#10167990) – Aacini Aug 10 '18 at 12:32

1 Answers1

1

Why don't you use the same call trick with the set command?

set i=2
set line[2]=hello
call echo %%line[%i%]%%
call set content=%%line[%i%]%%
echo %content%

Output:

> set i=2

> set line[2]=hello

> call echo %line[2]%
hello

> call set content=%line[2]%

> echo hello
hello
Stephan
  • 53,940
  • 10
  • 58
  • 91