This answer is what I want to do, but it works for strings NOT command output.
My script is:
@echo off
setlocal enabledelayedexpansion
for /F "skip=1 tokens=1,3,5,7" %%a in ('adb devices') do (
echo %%a
set dev1=%%a
set dev2=%%b
set dev3=%%c
set dev4=%%d
)
echo.
echo Devices are: !dev1!, !dev2!, !dev3!, !dev4!
pause
But it shows 1 device, instead of the 2 available:
770a56
emulator-5554
Devices are: emulator-5554, , ,
Press any key to continue . . .
Sample output from Windows:
C:\Windows\Right\Console2>adb devices
List of devices attached
BH90W3T416 device
HSMPG9265D606183 device
emulator-5554 device