V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
AzsharR
V2EX  ›  Android

用 BAT 调用 ADB 命令,第一条能运行,第二条显示不是内部命令,请问怎么弄。。。

  •  1
     
  •   AzsharR · Jun 18, 2020 · 13029 views
    This topic created in 2149 days ago, the information mentioned may be changed or developed.

    我在 bat 这方面是个新手,不是很了解,网上查了 也查不到 就想做个半自动安装的 bat 脚本

    adb devices ::adb shell ::查询手机连接情况

    @set /p path=APK path:

    adb install %path%

    ::echo end pause

    6 replies    2020-06-18 16:38:37 +08:00
    greed1is9good
        1
    greed1is9good  
       Jun 18, 2020 via Android
    自己看下 adb 命令+linux shell 命令
    hu8245
        2
    hu8245  
       Jun 18, 2020
    用 powershell 吧, 很好用。
    LLaMA2
        3
    LLaMA2  
       Jun 18, 2020
    你调用了 adb shell
    之后执行的命令回显管道已经没有了
    你可以试着如下
    举例


    @echo off
    :begin
    adb disconnect
    set input=
    set /p input=please input your device IP:
    adb connect %input%
    echo rooting this device!
    adb root
    echo remounting
    adb remount
    adb shell content query --uri content://telephony/carriers/preferapn
    echo replace APNs config file
    adb push apns-conf.xml /system/etc
    adb push apns-conf.xml.bakforspec /system/etc
    echo restoring default APN
    adb shell "content delete --uri content://telephony/carriers/restore"
    echo this device id is
    adb shell "settings get secure android_id"
    echo show file stat
    adb shell "busybox stat /system/etc/apns-conf.xml"
    adb shell "busybox stat /system/etc/apns-conf.xml.bakforspec"
    echo press any key for continue!
    pause>nul
    goto begin
    no1xsyzy
        4
    no1xsyzy  
       Jun 18, 2020
    跟 ADB 没关系,你覆盖了 PATH 环境变量
    RIcter
        5
    RIcter  
       Jun 18, 2020
    @set /p path=APK path:
    ...
    dingwen07
        6
    dingwen07  
       Jun 18, 2020
    set /p apkpath=APK path:

    adb install %apkpath%
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1072 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 46ms · UTC 22:59 · PVG 06:59 · LAX 15:59 · JFK 18:59
    ♥ Do have faith in what you're doing.