Get user input to install file -


i'd run file , see

"1 example_x 2 example_y 3 example_z

enter number apk install:"

then press 1, 2, or 3 , enter , script installs corresponding .apk via adb (android debug bridge).

when run now, message "can't find '1' install".

@echo off  set newline=^& echo.  set 1=example_x.apk set 2=example_y.apk set 3=example_z.apk  echo 1 example_x %newline% 2 example_y% 3 example_z %newline%  set /p userinput= enter number apk install:   adb install %userinput%  pause exit 

ok, situation choice command lookign (use in everycase possible). here need code:

(also problem not command, when use adb install %userinput% @ soloution)

code :

@echo off setlocal enabledelayedexpansion  set newline=^& echo.  set 1=example_x.apk set 2=example_y.apk set 3=example_z.apk  echo 1 example_x %newline% 2 example_y% 3 example_z %newline%  choice /c 123 /n /m "enter number apk install: " set userinput=%errorlevel%  adb install !%userinput%!  pause exit 

explanation of choice , !%userinput%! :

choice:

  • /n specify's not display "[1,2,3}" (which have done)
  • /c specify opitions
  • /m "" text display

!%userinput%!:

  • set userinput=%errorlevel% %errorlevel% ouput of choice command
  • !%userinput%! works if setlocal enabledelayedexpansion , means, whatever result %userinput% treated variable itself. (! treated same %)

hope helped, learn more, type command followed /?

yours mona


Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -