dauzduz TV
dauzduz TV

Reputation: 69

I am trying to set info from the array into the variable using second variable to retrive info

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%]%%

Upvotes: 0

Views: 27

Answers (1)

Stephan
Stephan

Reputation: 56180

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

Upvotes: 1

Related Questions