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脚本开发能 ...
随机推荐
- 课程四(Convolutional Neural Networks),第一周(Foundations of Convolutional Neural Networks) —— 0.Learning Goals
Learning Goals Understand the convolution operation Understand the pooling operation Remember the vo ...
- jenkins内部分享ppt
持续集成Continuous integration简介(持续集成是什么) .持续集成源于极限编程(XP),是一种软件实践,软件开发过程中集成步骤是一个漫长并且无法预测的过程.集成过程中可能会爆 ...
- error: device unauthorized —— android studio 链接不上虚拟机
问题原因: 以前用Eclipse开发的时候在环境变量里配置了ANDRIOD_SDK_HOME. 解决方法: 将电脑环境变量中的ANDRIOD_SDK_HOME删除,重新运行adb devices,手机 ...
- jQgrid学习笔记
jQgrid学习笔记
- Python sqlalchemy的基本使用
示例代码 from sqlalchemy import create_engine from sqlalchemy.ext.declarative import declarative_base fr ...
- 方便操作的命名范围scope
<?php namespace Goods\Model; use Think\Model; class GoodsModel extends Model { protected $_scope ...
- [转]debian9 安装任意版本mysql
Debian 9 - Install MySQL Server The steps below will show you how to install whichever version of My ...
- netty源码解解析(4.0)-1 核心架构
netty是java开源社区的一个优秀的网络框架.使用netty,我们可以迅速地开发出稳定,高性能,安全的,扩展性良好的服务器应用程序.netty封装简化了在服务器开发领域的一些有挑战性的问题:jdk ...
- OpenCV两种畸变校正模型源代码分析以及CUDA实现
图像算法中会经常用到摄像机的畸变校正,有必要总结分析OpenCV中畸变校正方法,其中包括普通针孔相机模型和鱼眼相机模型fisheye两种畸变校正方法. 普通相机模型畸变校正函数针对OpenCV中的cv ...
- SpringBoot之使用Scheduled做定时任务
定时任务有好多开源框架比如Quartz,@Scheduled是Spring的一个定时任务注解,通过注解配置就能够轻量级的定时任务,简单方便. 一.@Scheduled注解介绍 这里先贴上@Schedu ...