Advertisement
J2897

[Android] ADB Run Shell Script

Apr 5th, 2015
583
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 0.91 KB | None | 0 0
  1. :: Released under the GNU General Public License version 3 by J2897.
  2.  
  3. @echo OFF
  4. setlocal
  5.  
  6. set "ADB=C:\Android\adb.exe"
  7.  
  8. REM Make sure ADB is installed.
  9. if not exist "%ADB%" (
  10.     echo File not found...
  11.     echo %ADB%
  12.     goto :End
  13. )
  14.  
  15. if [%1]==[] (
  16.     echo Drop a shell script on top of this file to run it on your device.
  17.     goto :End
  18. )
  19.  
  20. set "FILENAME=%~nx1"
  21. set "LOCAL=%1"
  22. set "REMOTE=/storage/sdcard0/%FILENAME%"
  23. set "LOG_FILE=ADB Shell Script.log"
  24. "%ADB%" push "%LOCAL%" "%REMOTE%" || goto :End
  25. if not exist "%USERPROFILE%\Logs\" (md "%USERPROFILE%\Logs\")
  26.  
  27. REM Run interactively.
  28. :: "%ADB%" shell sh /sdcard/%FILENAME%
  29.  
  30. REM Run and write a log file.
  31. "%ADB%" shell sh /sdcard/%FILENAME% >"%USERPROFILE%\Logs\%LOG_FILE%" 2>&1
  32.  
  33. REM Show log file.
  34. start "" explorer /select,"%USERPROFILE%\Logs\%LOG_FILE%"
  35. start "" notepad "%USERPROFILE%\Logs\%LOG_FILE%"
  36.  
  37. :End
  38. echo.
  39. echo Finished!
  40. echo.
  41. endlocal
  42. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement