Dos命令之前更改的太简单,现在加入判断是否进入fasboot模式和判断Android镜像是否存在;代码已经尽量简化成这样,dos命令功能还是比较不好用的,用了一下午的时间。。。

  1. @echo off
  2.  
  3. ::路径注意增加\
  4. @set flashpath=Z:\DT380\LINUX\android\out\target\product\msm8953_64\
  5. @set Dynamic_library_Path=Z:\msm8909\out\target\product\msm8909\obj\lib\sensors.msm8909.so
  6. @set Sensors_conf=Z:\DT380\LINUX\android\vendor\qcom\proprietary\sensors\dsps\reg_defaults\sensor_def_qcomdev.conf
  7. @set boot_image=%flashpath%boot.img
  8. @set mbn_image=%flashpath%emmc_appsboot.mbn
  9. @set userdata_image=%flashpath%userdata.img
  10. @set system_image=%flashpath%system.img
  11. @set persist_image=%flashpath%persist.img
  12. @set ramdisk_image=%flashpath%ramdisk.img
  13. @set recover_image=%flashpath%recovery.img
  14. @set cache_image=%flashpath%cache.img
  15. @set Dynamic_library=%Dynamic_library_Path%
  16. @set Dynamic_library_Board_Path=/system/lib/
  17.  
  18. ::初始化,下面便是判断是否有文件
  19. @set Image_Index=
  20. @set Image_Current-path=
  21. @set Image_Length=
  22. @set Image[]-path=%boot_image%
  23. @set Image[]-path=%mbn_image%
  24. @set Image[]-path=%system_image%
  25. @set Image[]-path=%persist_image%
  26. @set Image[]-path=%ramdisk_image%
  27. @set Image[]-path=%recover_image%
  28. @set Image[]-path=%cache_image%
  29. @set Image[]-path=%Dynamic_library%
  30. ::初始化
  31.  
  32. :LoopStart
  33.  
  34. ::清空字符串
  35. @set Image_Current-path=
  36.  
  37. if %Image_Index% equ %Image_Length% goto BeginRun
  38.  
  39. for /f "usebackq tokens=1,2,3 delims==-" %%a in (`set Image[%Image_Index%]`) do (
  40. set Image_Current-%%b=%%c
  41. )
  42.  
  43. if exist %Image_Current-path% (
  44. @echo 该路径%Image_Current-path%存在......
  45. @echo.
  46. ) else (
  47. @echo %Image_Current-path%
  48. @echo 请确定该文件文件是否存在?如果不存在,请确定路径,打开脚本重新设置。10秒后关闭....
  49. @ping -n 127.0.0.1>nul
  50. exit
  51. )
  52.  
  53. @set /a Image_Index=%Image_Index%+
  54.  
  55. goto LoopStart
  56.  
  57. :BeginRun
  58. @echo 检查Android镜像文件已经完成,请继续下一步......
  59. @echo.
  60.  
  61. @echo 、同时烧录emmc_appsboot.mbnboot.img
  62. @echo 、烧录boot.img
  63. @echo 、烧录aboot.img
  64. @echo 、烧录persist.img
  65. @echo 、烧录ramdisk.img
  66. @echo 、烧录recovery.img
  67. @echo 、烧录system.img
  68. @echo 、烧录cache.img
  69. @echo 、烧录所有镜像
  70. @echo 、重新推进sensor.so
  71. ::@echo 、烧录并更新adsp架构下的sensor文件
  72.  
  73. @set /p option=请先设置路径后,再输入要烧录的选项:
  74.  
  75. if "%option%" == "" (
  76. adb root
  77. adb wait-for-device
  78. adb remount
  79. @echo 重新推进sensor........
  80. adb push %Dynamic_library% %Dynamic_library_Board_Path%
  81. adb reboot
  82. @echo 正在重启...... 5秒后关闭....
  83. @ping -n 127.0.0.1>nul
  84.  
  85. exit
  86. )
  87.  
  88. ::判断是否进入fastboot模式
  89. fastboot devices>.txt
  90. set /p message=<.txt
  91. del .txt
  92. if not defined message (
  93. echo 正处于adb mode模式.....
  94. adb wait-for-device
  95. adb reboot-bootloader
  96. ) else (
  97. echo 正处于fastboot mode模式.....
  98. )
  99.  
  100. @echo.
  101.  
  102. if "%option%" == "" (
  103. @echo 同时烧录emmc_appsboot.mbnboot.img........
  104. fastboot flash boot %boot_image%
  105. fastboot flash aboot %mbn_image%
  106. )
  107.  
  108. if "%option%" == "" (
  109. @echo 烧录boot.img........
  110. fastboot flash boot %boot_image%
  111. )
  112.  
  113. if "%option%" == "" (
  114. @echo 烧录aboot.img........
  115. fastboot flash aboot %mbn_image%
  116. )
  117.  
  118. if "%option%" == "" (
  119. @echo 烧录persist.img..........
  120. fastboot flash persist %persist_image%
  121. )
  122.  
  123. if "%option%" == "" (
  124. @echo 烧录ramdisk.img..........
  125. fastboot flash ramdisk %ramdisk_image%
  126. )
  127.  
  128. if "%option%" == "" (
  129. @echo 烧录recovery.img...........
  130. fastboot flash recovery %recover_image%
  131. )
  132.  
  133. if "%option%" == "" (
  134. @echo 烧录system.img........
  135. fastboot flash system %system_image%
  136. )
  137.  
  138. if "%option%" == "" (
  139. @echo 烧录cache.img...........
  140. fastboot flash cache %cache_image%
  141. )
  142.  
  143. if "%option%" == "" (
  144. @echo 烧录所有镜像.............
  145. fastboot flash boot %boot_image%
  146. fastboot flash aboot %mbn_image%
  147. fastboot flash persist %persist_image%
  148. fastboot flash ramdisk %ramdisk_image%
  149. fastboot flash recovery %recover_image%
  150. fastboot flash system %system_image%
  151. fastboot flash cache %cache_image%
  152. fastboot flash userdata %userdata_image%
  153. )
  154.  
  155. fastboot reboot
  156. @echo 正在重启 请稍后......
  157. adb wait-for-device
  158. adb root
  159. adb wait-for-device
  160.  
  161. @ping -n 127.0.0.1>nul
  162. adb shell dmesg > kmesg.log
  163. @echo kernel log已经导出.....
  164.  
  165. @echo [烧录成功,暂停5秒自动关闭]
  166. @ping -n 127.0.0.1>nul

其中用到的相应内容有dos命令for循环的使用:

参考博客:http://blog.csdn.net/wh_19910525/article/details/7912440

Bat数组使用的情况:http://www.jb51.net/article/67630.htm

我自己整理的For f中的tokens和delims怎么用?直接拉上百度知道,整理得到的。就不管链接了,贴上我的有道云笔记链接就行了:http://note.youdao.com/noteshare?id=728873fd0d9b1ea50a73aed3d476135e&sub=FD0225FD68AC400C8C909FE85C293202

bat脚本回车命令是echo.

批处理语句判断变量是否为空的方法:http://www.bathome.net/thread-4046-1-8.html

综上所述:脚本好恶心!

Dos烧录脚本的更多相关文章

  1. shell、cmd、dos和脚本语言杂谈(转)

    问题一:DOS与windows中cmd区别   在windows系统中,“开始-运行-cmd”可以打开“cmd.exe”,进行命令行操作. 操作系统可以分成核心(kernel)和Shell(外壳)两部 ...

  2. shell、cmd、dos和脚本语言区别和联系

    问题一:DOS与windows中cmd区别   在windows系统中,“开始-运行-cmd”可以打开“cmd.exe”,进行命令行操作. 操作系统可以分成核心(kernel)和Shell(外壳)两部 ...

  3. DOS批处理脚本

    先概述一下批处理是个什么东东.批处理的定义,至今我也没能给出一个合适的----众多高手们也都没给出----反正我不知道----看了我也不一定信服----我是个菜鸟,当然就更不用说了:但我想总结出一个“ ...

  4. shell、cmd、dos和脚本语言

    问题一:Shell是什么? 操作系统可以分成核心(kernel)和Shell(外壳)两部分,其中,Shell是操作系统与外部的主要接口,位于操作系统的外层,为用户提供与操作系统核心沟通的途径.Shel ...

  5. qualcomm batch 烧录脚本

    在烧录android系统候用到了windows的批处理文件,拿出来分析一下,顺便记录一下高通平台烧录系统的命令. @echo off :: @ :不显示后面的命令,就是后面的"echo of ...

  6. dos 下脚本编写须知

    主题为:doc脚本运行结束后,不自动退出终端. 方法1假设你的bat名字叫rabbit.bat你可以新开一个bat,内容是start rabbit.bat然后这个新的bat是不会自动关闭的 注意,这个 ...

  7. dos脚本语法学习

    一个dos批处理脚本,通过关键字搜索注册表并删除,坑很多,语法也很怪异,详情看注释 @echo off ::声明采用UTF-8编码,避免中文乱码问题,>NUL可以吞掉chcp输出的内容 chcp ...

  8. 小试牛刀C#作为脚本语言执行解密

    背景 我们知道Unity3d是通过C#脚本语言的形式来实现游戏的逻辑代码编写,同样SCOTT服务器也设置了通过C#脚本来实现游戏逻辑,但是本文并不是想真正分析解密他们的运行机制,只是想通过自己的一个需 ...

  9. bat脚本基础教程

    bat脚本就是DOS批处理脚本,就是将一系列DOS命令按照一定顺序排列而形成的集合,运行在windows命令行环境上.本文主要介绍bat脚本基础语法,希望完成本文内容学习之后具备基础的bat脚本开发能 ...

随机推荐

  1. Git学习系列之Windows上安装Git详细步骤(图文详解)

    前言 最初,Git是用于Linux下的内核代码管理.因为其非常好用,目前,已经被成功移植到Mac和Windows操作系统下. 鉴于大部分使用者使用的是Windows操作系统,故,这里详细讲解Windo ...

  2. 杜绝假死,Tomcat容器做到自我保护,设置最大连接数(服务限流:tomcat请求数限制)

    为了确保服务不会被过多的http长连接压垮,我们需要对tomcat设定个最大连接数,超过这个连接数的请求会拒绝,让其负载到其它机器.达到保护自己的同时起到连接数负载均衡的作用. 一.解决方案:修改to ...

  3. 【awesome-dotnet-core-learning】(2)-Sprache.Calc-表达式计算器

    [awesome-dotnet-core-learning](2)-Sprache.Calc-表达式计算器 示例代码托管在GITHUB上, 欢迎STAR! 严格来说, Sprache.Calc只是上一 ...

  4. Asp.net webform scaffolding结合Generic Unit of Work & (Extensible) Repositories Framework代码生成向导

    Asp.net webform scaffolding结合Generic Unit of Work & (Extensible) Repositories Framework代码生成向导 在上 ...

  5. Java设计模式学习记录-解释器模式

    前言 这次介绍另一个行为模式,解释器模式,都说解释器模式用的少,其实只是我们在日常的开发中用的少,但是一些开源框架中还是能见到它的影子,例如:spring的spEL表达式在解析时就用到了解释器模式,以 ...

  6. 安装searchd

    把安装包解压到 D:coreseek 创建表 create table product( id int key auto_increment, title ), content text ); ins ...

  7. C#检测是否联网

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.R ...

  8. MVC HtmlHelper用法

    HtmlHelper用来在视图中呈现 HTML 控件. 以下列表显示了当前可用的一些 HTML 帮助器. 本主题演示所列出的带有星号 (*) 的帮助器. ActionLink - Links to a ...

  9. SqlServer存储过程,学习

    存储过程:存储过程(Stored Procedure)是在大型数据库系统中,一组为了完成特定功能的SQL 语句集,经编译后存储在数据库中,用户通过指定存储过程的名字并给出参数(如果该存储过程带有参数) ...

  10. Liunx-常用命令杂烩(5)

    快捷键 ctrl+alt        显示鼠标 ctrl+alt+tab+F1~F6 :进入字符终端界面tty1~tty6,例如 ctrl+alt+tab+F7 :退出字符终端界面 简单命令相关 w ...