Advertisement
palm19098

Untitled

Jun 23rd, 2022
816
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. REM Install APK
  2.  
  3. @echo off
  4. setlocal enableDelayedExpansion
  5. set apk="C:\Users\Shuangwei\Downloads\Ragnarok Labyrinth NFT_45.2425.3_apkcombo.com.apk"
  6.  
  7. REM used to remove 'device' from each line
  8. set "replace=device"
  9. set "replaced="
  10. set "source=test.txt"
  11. set "target=clean.txt"
  12. REM adb command to grab all connected devices
  13. adb devices > adb.txt
  14. findstr /v "List of devices attached" adb.txt > test.txt
  15. (
  16.    for /F "tokens=1* delims=:" %%a in ('findstr /N "^" %source%') do (
  17.       set "line=%%b"
  18.       if defined line set "line=!line:%replace%=%replaced%!"
  19.       echo(!line!)
  20. ) > %target%
  21. REM with the 'clean' file of just device IDs, set them as elements of an array
  22. set idi=0
  23. for /F "usebackq" %%A in (clean.txt) do (
  24.     SET /A idi=!idi! + 1
  25.     set var!idi!=%%A
  26. )
  27. set var
  28.  
  29. set "replace1=."
  30. set "replace2=:"
  31. set "empty="
  32.  
  33. @echo on
  34. for /L %%x in (1, 1, %idi%) do (
  35.     set "line=!var%%x!"
  36.     if defined line set "line=!line:%replace1%=%empty%!"
  37.     if defined line set "line=!line:%replace2%=%empty%!"
  38.    
  39.     adb -s !var%%x! install -r !apk!)
  40. pause
Advertisement
RAW Paste Data Copied
Advertisement