V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
AzsharR
V2EX  ›  Android

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

  •  1
     
  •   AzsharR · 2020-06-18 14:19:43 +08:00 · 4510 次点击
    这是一个创建于 1399 天前的主题,其中的信息可能已经有所发展或是发生改变。

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

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

    @set /p path=APK path:

    adb install %path%

    ::echo end pause

    6 条回复    2020-06-18 16:38:37 +08:00
    greed1is9good
        1
    greed1is9good  
       2020-06-18 14:29:30 +08:00 via Android
    自己看下 adb 命令+linux shell 命令
    hu8245
        2
    hu8245  
       2020-06-18 14:32:08 +08:00
    用 powershell 吧, 很好用。
    LLaMA2
        3
    LLaMA2  
       2020-06-18 14:35:01 +08:00
    你调用了 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  
       2020-06-18 14:41:40 +08:00
    跟 ADB 没关系,你覆盖了 PATH 环境变量
    RIcter
        5
    RIcter  
       2020-06-18 14:54:24 +08:00
    @set /p path=APK path:
    ...
    dingwen07
        6
    dingwen07  
       2020-06-18 16:38:37 +08:00
    set /p apkpath=APK path:

    adb install %apkpath%
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5736 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 03:02 · PVG 11:02 · LAX 20:02 · JFK 23:02
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.