Dos烧录脚本
Dos命令之前更改的太简单,现在加入判断是否进入fasboot模式和判断Android镜像是否存在;代码已经尽量简化成这样,dos命令功能还是比较不好用的,用了一下午的时间。。。
@echo off ::路径注意增加\
@set flashpath=Z:\DT380\LINUX\android\out\target\product\msm8953_64\
@set Dynamic_library_Path=Z:\msm8909\out\target\product\msm8909\obj\lib\sensors.msm8909.so
@set Sensors_conf=Z:\DT380\LINUX\android\vendor\qcom\proprietary\sensors\dsps\reg_defaults\sensor_def_qcomdev.conf
@set boot_image=%flashpath%boot.img
@set mbn_image=%flashpath%emmc_appsboot.mbn
@set userdata_image=%flashpath%userdata.img
@set system_image=%flashpath%system.img
@set persist_image=%flashpath%persist.img
@set ramdisk_image=%flashpath%ramdisk.img
@set recover_image=%flashpath%recovery.img
@set cache_image=%flashpath%cache.img
@set Dynamic_library=%Dynamic_library_Path%
@set Dynamic_library_Board_Path=/system/lib/ ::初始化,下面便是判断是否有文件
@set Image_Index=
@set Image_Current-path=
@set Image_Length=
@set Image[]-path=%boot_image%
@set Image[]-path=%mbn_image%
@set Image[]-path=%system_image%
@set Image[]-path=%persist_image%
@set Image[]-path=%ramdisk_image%
@set Image[]-path=%recover_image%
@set Image[]-path=%cache_image%
@set Image[]-path=%Dynamic_library%
::初始化 :LoopStart ::清空字符串
@set Image_Current-path= if %Image_Index% equ %Image_Length% goto BeginRun for /f "usebackq tokens=1,2,3 delims==-" %%a in (`set Image[%Image_Index%]`) do (
set Image_Current-%%b=%%c
) if exist %Image_Current-path% (
@echo 该路径%Image_Current-path%存在......
@echo.
) else (
@echo %Image_Current-path%
@echo 请确定该文件文件是否存在?如果不存在,请确定路径,打开脚本重新设置。10秒后关闭....
@ping -n 127.0.0.1>nul
exit
) @set /a Image_Index=%Image_Index%+ goto LoopStart :BeginRun
@echo 检查Android镜像文件已经完成,请继续下一步......
@echo. @echo 、同时烧录emmc_appsboot.mbn和boot.img
@echo 、烧录boot.img
@echo 、烧录aboot.img
@echo 、烧录persist.img
@echo 、烧录ramdisk.img
@echo 、烧录recovery.img
@echo 、烧录system.img
@echo 、烧录cache.img
@echo 、烧录所有镜像
@echo 、重新推进sensor.so
::@echo 、烧录并更新adsp架构下的sensor文件 @set /p option=请先设置路径后,再输入要烧录的选项: if "%option%" == "" (
adb root
adb wait-for-device
adb remount
@echo 重新推进sensor........
adb push %Dynamic_library% %Dynamic_library_Board_Path%
adb reboot
@echo 正在重启...... 5秒后关闭....
@ping -n 127.0.0.1>nul exit
) ::判断是否进入fastboot模式
fastboot devices>.txt
set /p message=<.txt
del .txt
if not defined message (
echo 正处于adb mode模式.....
adb wait-for-device
adb reboot-bootloader
) else (
echo 正处于fastboot mode模式.....
) @echo. if "%option%" == "" (
@echo 同时烧录emmc_appsboot.mbn和boot.img........
fastboot flash boot %boot_image%
fastboot flash aboot %mbn_image%
) if "%option%" == "" (
@echo 烧录boot.img........
fastboot flash boot %boot_image%
) if "%option%" == "" (
@echo 烧录aboot.img........
fastboot flash aboot %mbn_image%
) if "%option%" == "" (
@echo 烧录persist.img..........
fastboot flash persist %persist_image%
) if "%option%" == "" (
@echo 烧录ramdisk.img..........
fastboot flash ramdisk %ramdisk_image%
) if "%option%" == "" (
@echo 烧录recovery.img...........
fastboot flash recovery %recover_image%
) if "%option%" == "" (
@echo 烧录system.img........
fastboot flash system %system_image%
) if "%option%" == "" (
@echo 烧录cache.img...........
fastboot flash cache %cache_image%
) if "%option%" == "" (
@echo 烧录所有镜像.............
fastboot flash boot %boot_image%
fastboot flash aboot %mbn_image%
fastboot flash persist %persist_image%
fastboot flash ramdisk %ramdisk_image%
fastboot flash recovery %recover_image%
fastboot flash system %system_image%
fastboot flash cache %cache_image%
fastboot flash userdata %userdata_image%
) fastboot reboot
@echo 正在重启 请稍后......
adb wait-for-device
adb root
adb wait-for-device @ping -n 127.0.0.1>nul
adb shell dmesg > kmesg.log
@echo kernel log已经导出..... @echo [烧录成功,暂停5秒自动关闭]
@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烧录脚本的更多相关文章
- shell、cmd、dos和脚本语言杂谈(转)
问题一:DOS与windows中cmd区别 在windows系统中,“开始-运行-cmd”可以打开“cmd.exe”,进行命令行操作. 操作系统可以分成核心(kernel)和Shell(外壳)两部 ...
- shell、cmd、dos和脚本语言区别和联系
问题一:DOS与windows中cmd区别 在windows系统中,“开始-运行-cmd”可以打开“cmd.exe”,进行命令行操作. 操作系统可以分成核心(kernel)和Shell(外壳)两部 ...
- DOS批处理脚本
先概述一下批处理是个什么东东.批处理的定义,至今我也没能给出一个合适的----众多高手们也都没给出----反正我不知道----看了我也不一定信服----我是个菜鸟,当然就更不用说了:但我想总结出一个“ ...
- shell、cmd、dos和脚本语言
问题一:Shell是什么? 操作系统可以分成核心(kernel)和Shell(外壳)两部分,其中,Shell是操作系统与外部的主要接口,位于操作系统的外层,为用户提供与操作系统核心沟通的途径.Shel ...
- qualcomm batch 烧录脚本
在烧录android系统候用到了windows的批处理文件,拿出来分析一下,顺便记录一下高通平台烧录系统的命令. @echo off :: @ :不显示后面的命令,就是后面的"echo of ...
- dos 下脚本编写须知
主题为:doc脚本运行结束后,不自动退出终端. 方法1假设你的bat名字叫rabbit.bat你可以新开一个bat,内容是start rabbit.bat然后这个新的bat是不会自动关闭的 注意,这个 ...
- dos脚本语法学习
一个dos批处理脚本,通过关键字搜索注册表并删除,坑很多,语法也很怪异,详情看注释 @echo off ::声明采用UTF-8编码,避免中文乱码问题,>NUL可以吞掉chcp输出的内容 chcp ...
- 小试牛刀C#作为脚本语言执行解密
背景 我们知道Unity3d是通过C#脚本语言的形式来实现游戏的逻辑代码编写,同样SCOTT服务器也设置了通过C#脚本来实现游戏逻辑,但是本文并不是想真正分析解密他们的运行机制,只是想通过自己的一个需 ...
- bat脚本基础教程
bat脚本就是DOS批处理脚本,就是将一系列DOS命令按照一定顺序排列而形成的集合,运行在windows命令行环境上.本文主要介绍bat脚本基础语法,希望完成本文内容学习之后具备基础的bat脚本开发能 ...
随机推荐
- Maven项目报错:Missing artifact****和ArtifactDescriptorException: Failed to read artifact descriptor for***和Cannot change version of project facet Dynamic web module to 2.5
一.关于Cannot change version of project facet Dynamic web module to 2.5 具体查看博客:http://blog.csdn.net/ste ...
- 如何用python爬取两个span之间的内容
Python用做数据处理还是相当不错的,如果你想要做爬虫,Python是很好的选择,它有很多已经写好的类包,只要调用,即可完成很多复杂的功能,此文中所有的功能都是基于BeautifulSoup这个包. ...
- 服务端如何安全获取客户端请求IP地址
服务端如何获取客户端请求IP地址,网上代码一搜一大把.其中比较常见有x-forwarded-for.client-ip等请求头,及remote_addr参数,那么为什么会存在这么多获取方式,以及到底怎 ...
- 深入理解String, StringBuffer, StringBuilder的区别(基于JDK1.8)
String.StringBuffer.StringBuilder都是JAVA中常用的字符串操作类,对于他们的区别大家也都能耳熟能详,但底层到底是怎样实现的呢?今天就再深入分析下这三种字符串操作的区别 ...
- Java并发编程笔记之AbstractQueuedSynchronizer源码分析
为什么要说AbstractQueuedSynchronizer呢? 因为AbstractQueuedSynchronizer是JUC并发包中锁的底层支持,AbstractQueuedSynchroni ...
- JS判断是否是数组的四种做法
一.前言 如何判断一个对象或一个值是否是一个数组,在面试或工作中我们常常会遇到这个问题,既然出现频率高,想着还是做个整理,那么本文主要基于几种判断方式,以及方式判断的原理,是否存在问题展开讨论. 二. ...
- Java关键字(一)——instanceof
instanceof 严格来说是Java中的一个双目运算符,用来测试一个对象是否为一个类的实例,用法为: boolean result = obj instanceof Class 其中 obj 为一 ...
- openssl passwd
openssl系列文章:http://www.cnblogs.com/f-ck-need-u/p/7048359.html 该伪命令用于生成加密的密码. [root@xuexi tmp]# whati ...
- C++多重继承的构造执行顺序
一个类,它可能有基类,也可能存在多个基类,这些类里面还可能是虚拟基类,并且在类的本身也可能存在对象成员.那么所涉及的这些类或对象成员会以什么样的顺序来调用它们各自的构造函数呢?今天我们就来举例分析下. ...
- LINQ 小项目【组合查询、分页】
使用 linq 在网页上对用户信息增删改,组合查询,分页显示 using System; using System.Collections.Generic; using System.Linq; us ...