sNikunj
sNikunj

Reputation: 11

How to store values in array using batch script

Is this possible to store list of packages in array using batch script.

SET array=(adb shell pm list packaages -3)

Upvotes: 0

Views: 1270

Answers (2)

Aacini
Aacini

Reputation: 67216

Although I don't know bash, this is the way to store a list of anything in a variable in Batch:

set Array=adb shell pm list packages -3
for %%v in (%Array%) do echo %%v

To group several words in the same element, enclose they in quotes:

set Array=adb "shell pm" "list packages -3"

In this case you may use this form in order to eliminate the quotes:

for %%v in (%Array%) do echo %%~v

Upvotes: 2

Benjamin Toueg
Benjamin Toueg

Reputation: 10867

array=$(adb shell pm list packages -3)

Upvotes: 0

Related Questions