[Q] [Solved] batch file question(s) for auto adb - HTC Sensation

okay so im creating a batch file for a little automation just mainly for rebooting the device into bootloader/recovery.. i have gotten most of the way through but at the end i would like for the batch file to stop and allow for further manual input (like i have it set to reboot the device into bootloader and then i would like the window to stop and allow me to MANUALLY input the next command such as flash/reboot/whatever) however i cant seem to find any way of doing that
HERE IS WHAT I HAVE CURRENTLY
it all works perfectly just for the issue i cant seem to work out
ECHO OFF
ECHO ============== CHANING DIRECTORY ==============
CD c:\program files (x86)\android\android-sdk\tools
TIMEOUT 2 /NOBREAK >nul
ECHO ........ Done
ECHO ============== CHECKING ADB DEVICE CONNECTION ==============
TIMEOUT 2 /NOBREAK >nul
adb devices
ECHO ........ Done
PAUSE
:MENU
ECHO.
ECHO ================== ADB MENU ==================
ECHO PRESS 1 or 2 to select your task, or 3 to EXIT.
ECHO.
ECHO 1 - Reboot Device into Bootloader [FASTBOOT]
ECHO 2 - Reboot Device into Recovery [CLOCKWORK MOD]
ECHO 3 - EXIT
ECHO.
SET /P M=Type 1, 2, or 3, then press ENTER:
IF %M%==1 GOTO BOOTLOADER
IF %M%==2 GOTO RECOVERY
IF %M%==3 GOTO EOF
:BOOTLOADER
adb reboot bootloader
GOTO FASTBOOT
:RECOVERY
adb reboot recovery
GOTO RECOVERY
:FASTBOOT
ECHO .
ECHO Waiting for device to reconnect
TIMEOUT 15 /NOBREAK >nul
ECHO ........ Done
ECHO ================== FASTBOOT ==================
ECHO manually type fastboot commands
:RECOVERY
ECHO .
ECHO Waiting for device to reconnect
TIMEOUT 15 /NOBREAK >nul
ECHO ........ Done
ECHO ================== RECOVERY ==================
ECHO Manually handle Clockwork Recovery tasks
ECHO .
ECHO .
ECHO Will automatically close in about 5 Seconds =]
TIMEOUT 5 /NOBREAK >nul
ECHO ....... bye!

I am not sur to understand exactly what you want to do, but you can do what you want in you batch file, it is what you did with for exemple :
- "Reboot Device into Bootloader [FASTBOOT]"
- "Reboot Device into Recovery [CLOCKWORK MOD]"
You have just check the choice with a number and after execute your "code".
So, if you know the "adb script" in addiction of the command you want, go to "code" it.
I remake your script and i especially add an exemple.
- "Execution" and "Code" are more clear.
- It is better for checking error.
- Now, this script is able to check if you are in "64bit" or "32bit", and check if the "ADB Tool" is in his correct way.
- Now, this script is able to check if you have connect or not your device.
- You can see the BootAnimation without "Power OFF" and then "Power ON" your phone.
- It is more beautiful, even if it is not very important.
The new "code", with your previous "started code" :
Code:
Even this topic is solved, i remove my code.

cheers for the reply.. but that was not really what i was after... i did some more googling and what i found was (in the last 2 minutes) that i needed a CMD /K at the end of the file.. which leaves the command window open and i can now enter in fastboot commands manually (for flashing etc)... i have attached the file as a.txt for anyone to use themselves if they were so inclined..
1. just make sure the directory of your adb/fastboot.exe is in the same directory as mine (CD c:\program files (x86)\android\android-sdk\tools) and change the 2 lines if necessary with note pad by opening the .txt normally as yours might be in program files or in platform-tools not tools, etc
2. change the extension to .bat and not .txt
3. chuck it in your task bar/start bar etc for quicker acess
and should be good to go =]
edit: i see the checking that the other fellow put it can do the checking for you.. but for me i knew the directory, etc

So, i did not exaclty understand your aim, but you have found it, so it is perfect.
I remake my previous script to do exactly what you want, and i always check every thing during the execution, to know the mistake when we have a problem. Because my version is for everybody, even if i think it is just for us. (Views: 45)
So if you want it, or someone else, just ask me.

ptit developer said:
So, i did not exaclty understand your aim, but you have found it, so it is perfect.
I remake my previous script to do exactly what you want, and i always check every thing during the execution, to know the mistake when we have a problem. Because my version is for everybody, even if i think it is just for us. (Views: 45)
So if you want it, or someone else, just ask me.
Click to expand...
Click to collapse
no worries mate it was my first time writing an entire script so im pretty stoked with the outcome i tried to keep it looking as real as scripts i have seen as possible.. =]

I will continue to develop this idea : "A easy way to use ADB Menu".
When i will have finish, if you want i will post a link here to it.

ptit developer said:
I will continue to develop this idea : "A esay way to use ADB Menu".
When i will have finish, if you want i will post a link here to it.
Click to expand...
Click to collapse
sure mate.. ill edit the op if you like and can sort something out?
i think the simpler nature allows for much to be automated for mundane tasks... as long as you keep the fastboot commands manual so noobs dont do anything incorrect

I will use what you want, and i will add what i post in my first answer here.
In addition of this, i will post the final "A easy way to use ADB Menu" on a new topic on other section.
And i will post news here, because i think you will look it.

Related

idea for dualbooting android builds... somewhat

alrighty, basically im lazy and want someone else to do this for me.
heres my idea:
you install rc33 or whatever you want, make a nandroid backup of it, rename the folder to OS1. this folder contains your boot.img data.img and so on
then install or place a nandroid backup of another build into a folder called OS2..
then you would be able to boot into the modified recovery mode, which would have the selection to run a script, which then asks which OS to flash, 1 or 2, you press 1 or 2 wait for it to flash and reboot, a little hacky way to get a dual boot...
now who wants to repack a recovery image for me?
good idea would be worth a try , too bad im not up to par for the job , but id like to see it done
i'll give this a shot tomorrow and see what happens, not really feeling like doing it now. and i'm not gonna do it via rebuilding the recovery.img, just gonna make a script that does it for me from the recovery terminal. i'm quite lazy as well and i already have a script that runs the fastboot commands from my computer script to flash from one build to another, in theory it shouldn't be too hard to get the script terminal reaady and do that.
tubaking182 said:
i'll give this a shot tomorrow and see what happens, not really feeling like doing it now. and i'm not gonna do it via rebuilding the recovery.img, just gonna make a script that does it for me from the recovery terminal. i'm quite lazy as well and i already have a script that runs the fastboot commands from my computer script to flash from one build to another, in theory it shouldn't be too hard to get the script terminal reaady and do that.
Click to expand...
Click to collapse
I have a .bat file that I use to flash back and forth from Windows.
To RC33
cd C:\Android\
@echo off
echo :::Instructions:::
echo You must have:
echo system.img
echo data.img
echo boot.img
echo installed in the "C:\Android" directory
echo then enable fastboot on device before proceeding
pause
fastboot flash system system.img
fastboot flash userdata data.img
fastboot flash boot boot.img
fastboot reboot
Click to expand...
Click to collapse
To 502H
cd C:\Android\502H\
@echo off
echo :::Instructions:::
echo You must have:
echo system.img
echo data.img
echo boot.img
echo installed in the "C:\Android\502H" directory
echo then enable fastboot on device before proceeding
pause
fastboot flash system system.img
fastboot flash userdata data.img
fastboot flash boot boot.img
fastboot reboot
Click to expand...
Click to collapse
Pretty simple. I have them stored to my desktop. I save my nandroid backups to the appropriate file and just double click. No problem. I just wish there was a script that I can use to reboot into HARDSPL mode (someone tell me if there is).
keatonreckard:
This is the worst idea i've heard so far...
FLASH has a limited life-time, and rewriting the whole system at every boot is a BAD idea.
If you want to dual-boot, you should look into making your own init-system, adding the ability to load another system (From SD).
Binary100100:
"adb reboot bootloader"
there might be a simpler way: change the kernel command so it mounts somewhere in sdcard as root. not sure how to do this without a computer though.
Hey binary, with your phone plugged into your comp pull up you cmd and type adb shell reboot bootloader, the phone will boot right into fastboot mode making it easy to continue the script
just to clarify...i meant a script that is store locally on the device in the recovery image... so then you dont need a computer at all... you can already do this, you just have to type in the commands from the recovery console...i just wanted an easier way to do it
Binary100100 said:
I have a .bat file that I use to flash back and forth from Windows.
To RC33
To 502H
Pretty simple. I have them stored to my desktop. I save my nandroid backups to the appropriate file and just double click. No problem. I just wish there was a script that I can use to reboot into HARDSPL mode (someone tell me if there is).
Click to expand...
Click to collapse
To flash back and forth from windows? You've been running Windows Mobile on the Dream? I must be missing something.
Joushou said:
keatonreckard:
This is the worst idea i've heard so far...
FLASH has a limited life-time, and rewriting the whole system at every boot is a BAD idea.
If you want to dual-boot, you should look into making your own init-system, adding the ability to load another system (From SD).
Binary100100:
"adb reboot bootloader"
Click to expand...
Click to collapse
not flash at every boot...just so you can text out a build and if you dont like it go back to a stable one on the go....
again, im taking the lazy way out
Disregard! - My mind ran ahead of what this post was about and I posted something regarding a slightly different idea!
I don't know about re-installing Nandroid backups...
But, if one wanted to be able to run two different installs...
Seems to me an easier way about doing this would be to have a modified SPL. It could have the option of selecting an update file...
For example, one could put two files on their sd card - update1.zip and update2.zip. The SPL could have one of the following options:
1) reboot into recovery mode - select "alt-s" - then you would have an option to select 1 or 2.
2) have an additional "Alt- " option.
"Alt-s" - runs update1.zip
"Alt-?" - runs update2.zip. (dev could pick the additional letter)
I think this would be great! No reteaching of anyone how to use the process. And, one could leave the primary use-able update.zip as "update1.zip" and use the other as the version being tried out. It wouldn't be a Nandroid back up... But, with the new "nowipe" builds it should work well.
My $.02 worth.
Joushou said:
keatonreckard:
This is the worst idea i've heard so far...
FLASH has a limited life-time, and rewriting the whole system at every boot is a BAD idea.
If you want to dual-boot, you should look into making your own init-system, adding the ability to load another system (From SD).
Binary100100:
"adb reboot bootloader"
Click to expand...
Click to collapse
To be fair, that limited life-time is something like 1,000,000 writes, which would take about... oh... a year straight of constantly rebooting your phone(assuming it takes 30 seconds per reboot)
EDIT: and that assumes re-writing the whole system every time you boot, which I don't think he means since he's saying its in the recovery image.
hmmm....
I know that from the alt+x console you can do this....
mount sdcard
echo "boot-recovery
--update_package=SDCARD:build1/update.zip" > /cache/recovery/command
reboot recovery
so if you wanted 2 builds available (I would think you would need a wipe for 2 completely different builds) but....
make 2 folders in on your sdcard
build1
build2
place a copy of the update.zip from each build you want to boot in the folder
make a script like this
Code:
echo "boot-recovery
--update_package=SDCARD:"$"/update.zip" > /cache/recovery/command
reboot recovery
save the script to the sdcard directory
then when you start your phone you could
1. type "mount sdcard" (no quotes)
2. type "sh sdcard/script.sh build1" (for build 1 located in /sdcard/build1/update.zip)
3. type "sh sdcard/script.sh build2" (for build 2 located in /sdcard/build2/update.zip)
problem would be when wipes are needed. But if you have 2 solid builds and don't need to wipe when swapping it should work.
Just need a way to make a script or bootloader that could run either one of these.
Cannot see another way around it since the OS is loaded into phone ROM/RAM
of course if your build supports the reboot command from the OS then you could just make a script to run when you want to reload the other build. Then you could skip the recovery console.
@beagz - Ha, forgot about that script. Yes, to switch between say, the DudesG build and Haykuro's H build one could write a script like that in Gscript and change back and forth when a new build comes out.
Like now... One could run Dudes G build and try out Haykuro's new ADP1.5 build.
But, I do believe your right about going back to a JF33 build - would need to wipe...
Gimpeh said:
To flash back and forth from windows? You've been running Windows Mobile on the Dream? I must be missing something.
Click to expand...
Click to collapse
Nah.. I was referring to using a bat file on my Windows computer to switch between 1.1 to 1.5 back to 1.1 by just executing the bat.
Now that i know that "adb reboot bootloader" will work it can be completely automated!
... but will it default to fastboot? Hmmm...
tubaking182 said:
Hey binary, with your phone plugged into your comp pull up you cmd and type adb shell reboot bootloader, the phone will boot right into fastboot mode making it easy to continue the script
Click to expand...
Click to collapse
Thanks! But is this going to put the phone in FASTBOOT mode? I'm trying to make this completely automatic if it's possible. Simply keep your latest and greatest backup .img's in a certain directory on your computer and EXECUTE!
Take a shower or whatever... come back and VOILA! Your previous backup.
The method that I've come up with thus far is pretty simple... but you just can't execute and walk away. You still need to enable FASTBOOT at the least on the bootloader. Although I haven't tried messing with it lately. I have my phone just like I want it.
Now that the Official ADP1.5 is out let's get to work on Mulitouch, themes, etc!
Wow this seems crazy but it just might work. Lol.
bat file to automatically restore backups using Windows!
So all you need to do is...
Open notepad, copy and paste the quoted text below, edit the top line of this bat file to the directory of your backups (I used "c:\android" for an example), save as .bat and double click. Wait and your done. Just watch it happen automatically.
Also if you decide to change that directory on the top line also use the directory on the 14th line. Your done. Easy restore to a backup.
HINT! Make a couple of these with a variety of directories on the top to change what backup your want to flash back to.
Example: c:\android\rc33; c:\android\501h; c:\android\adp15; etc
cd C:\android
color A
cls
@echo off
echo.
echo :::Instructions:::
echo.
echo You must have:
echo.
echo system.img
echo data.img
echo boot.img
echo.
echo installed in the "c:\android" directory
echo.
pause
cls
color b
echo.
echo.
echo.
echo Now restoring:
echo.
echo system.img
echo data.img
echo boot.img
echo.
echo to your device.
color c
echo.
echo DO NOT TURN OFF OR UNPLUG YOUR DEVICE DURING THIS PROCESS!!!
@adb shell reboot bootloader
@fastboot flash system system.img
@fastboot flash userdata data.img
@fastboot flash boot boot.img
@fastboot reboot
Click to expand...
Click to collapse
I've tested it and it works beautifully!
Hope it helps!
Thanks to everyone that pointed out the command "adb shell reboot bootloader"
This post is noob friendly.
OR
Use this script below for it to prompt for the location of your backups.
color A
cls
@echo off
echo.
echo :::Instructions:::
echo.
echo Enter directory of nandroid backups that you would like to restore...
set /p flash=path:
cd %flash%
cls
color b
echo.
echo.
echo.
echo Now restoring:
echo.
echo system.img
echo data.img
echo boot.img
echo.
echo to your device.
color c
echo.
echo DO NOT TURN OFF OR UNPLUG YOUR DEVICE DURING THIS PROCESS!!!
@adb shell reboot bootloader
@fastboot flash system system.img
@fastboot flash userdata data.img
@fastboot flash boot boot.img
@fastboot reboot
Click to expand...
Click to collapse
This one is even more noob friendly... but it's not as fast because it requires you to enter the location of your backups.
I hope it helps someone out there. It helps me.
[email protected]:
The average lifetime of flash is 100.000 writes, and flash isn't delivered 100% intact, they're usually delivered with faulty blocks (Depending on where you get it, blah blah blah).
That should change your numbers a bit (A month i believe?)
And, sure, he is using the update-zip, so it's not written to the same pages every time.
But still, it's a bad idea (Other than wearing stuff down, it will also be very slow ).
To dual-boot, modifying the init-system so it could choose from different android-runtimes would be way faster/cooler...
If possible, this would be pretty damn useful. Using a stable build while being able to tinker with experimental builds. Would definitly cut down on the constant flashing back and forth.

Need an easy programing hand... Create bat file =)...

It's been a long time since the last time I made a bat file and it seems I can't remember how to exactly make one xD... I'm kind of tired of having to put the commands to change the radio, spl and recovery every time, so I've decided to make a simple bat file to be able to choose what files to install if files 1 or 2 (1 being old radio, spl, recovery, and 2 being the new)...
Here is what I got so far xD...
Code:
@echo off
cls
:start
echo.
echo 1. Press 1 to install old files
echo 2. Press 2 to install new files
set choice=
set /p choice=Press 1 or 2 to continue
<--- This section is for option 1 --->(this lines are just to show what option is each)
C:\Android\fastboot flash radio Radio1.img
C:\Android\fastboot flash hboot hboot1.img
C:\Android\fastboot flash recovery recovery1.img
C:\Android\fastboot erase system -w
C:\Android\fastboot reboot-bootloader
<--- End sextion 1 --->
<--- This section is for option 2 --->
C:\Android\fastboot flash radio Radio2.img
C:\Android\fastboot flash hboot hboot2.img
C:\Android\fastboot flash recovery recovery2.img
C:\Android\fastboot erase system -w
C:\Android\fastboot reboot-bootloader
<--- End section 2 --->
fin:
I hope anybody can give me a hand into this =P... I've forgot almost everything in creating this kind of files xD... I know I can make 2 different batch files for the diferents files, but is more commfortable to have everything in just 1 file...
Thanks in advance
YEah..... Not sure how much you want to mess with automated Radio/spl installing. those are the 2 most dangerous parts and what happens if you get an error mid way through?
Be careful
crypysmoker said:
YEah..... Not sure how much you want to mess with automated Radio/spl installing. those are the 2 most dangerous parts and what happens if you get an error mid way through?
Be careful
Click to expand...
Click to collapse
That's why I'm including a "press a key to continue" after each part ...
The only problem so far, wast test the script and forgot to make a nandroid backup xD...
I think this is what you want:
Code:
@echo off
:start
cls
echo 1. Press 1 to install old files
echo 2. Press 2 to install new files
set /p choice=Press 1 or 2 to continue:
if %choice%==1 goto choice1
if %choice%==2 goto choice2
:choice1
echo Choice1 command should go here
set /p anykey=Command complete, press any key to continue...
exit
:choice2
echo Choice2 command should go here
set /p anykey=Command complete, press any key to continue...
exit
Reference:http://en.wikipedia.org/wiki/Batch_file
Thanks, I've already got a functional batch file...
Now I'm gonna port it to C or something to get a program that works for everybody, that way it would be easier to change the radios and stuff...

[TUTORIAL] Make your own zipping and extracting tool.

Disclaimer
Code:
I have made this tutorial just to help people and share what I learnt. This tutorial in no way can cause any damage. But in case you yourself have done something wrong, I will be in noway responsible for it.
Pre-requisite knowledge:
1. A little knowledge about batch commands cause I'm not going to explain the basic commands like ECHO, PAUSE, CLS or similar commands here.
2. How to use a PC and keyboard.
Things Needed:
1. Notepad++ (Google it!)
2. A 7z file.(Most important)- Get it from here.
3. A windows machine.
4. An unbricked brain.
5. Kindness to press THANKS.
How to do it?
1. Open notepad and enter the following command to start your coding:
Code:
@echo off
color 1f
title Zipper Unzipper by alokbina
You can replace the title with whatever you desire. The title comes at the title bar of your CMD window.
2. Now making your menu for creating the 2 desired options. For that leave a line after writing the above code and write the following code:
Code:
echo.
echo Please select one of the following options you want to do :
echo.
echo 1.Unzip/Extract zip file.
echo 2.Compress/Zip/Archieve files and folders.
echo x.Exit
echo.
set /p se=Select your decision
if %se%==1 (goto unzip)
if %se%==2 (goto zip)
if %se%==x (goto exit)
Here you can change the word "se" with your desired letters but be sure to also change all the "se" with the same letters.
2. Now make 3 folders in the directory where you are making the tool named as COMPRESS, EXTRACT and zip. In the zip directory place the 7za file that you downloaded. And in both the other diectories, i.e., COMPRESS and EXTRACT make a folder named INPUT in each folder.
In the /COMPRESS/INPUT folders you will place the files you want to make a zip and in the /EXTRACT/INPUT folder, you will place the zip that you want to extract.
3. After that we will build our first menu, that is, the unzipping menu. Use the following code for that:
Code:
:unzip
cls
echo.
echo Please place the zip file, i.e. the zip you want to extract in /EXTRACT/INPUT directory.
echo.
pause
echo Extracting...
echo.
mkdir %cd%\EXTRACT\OUT
if exist "%cd%\EXTRACT\INPUT\*.zip" (call %cd%\zip\7za.exe x "%cd%\EXTRACT\INPUT\*" -o"%cd%\EXTRACT\OUT")
echo All done! Congrats. You can find the extracted files in /EXTRACT/OUT directory.
echo.
pause
goto exit
Here the mkdir command will make a directory in the /EXTRACT folder named as OUT where you can see the the extracted files.
4. Now time to build the zipping menu. Use the following code for that:
Code:
:zip
cls
echo.
echo Please place the files and folder you want to compress in /COMPRESS/INPUT directory.
echo.
pause
echo COMPRESSING...
echo.
mkdir %cd%\COMPRESS\OUT
start %cd%\zip\7za a -mx9 -tzip "%cd%\COMPRESS\OUT\compressed.zip" "%cd%\COMPRESS\INPUT\*"
echo All done! Congrats. You can find the compressed zip in /COMPRESS/OUT directory.
echo.
pause
goto exit
Here mkdir will make a directory in the /COMPRESS folder named as OUT where you can see the the compressed files named as compress.zip. Here the start command will order the 7za file to compress the files. Thus another window will open for compression.
5. Now finally making the exit command. Use the following code for it:
Code:
:exit
exit
So finally you will have 3 folders-COMPRESS, EXTRACT and zip. In zip folder you will have one file 7za and in the other 2 folders you will have a folder named INPUT in each. Your final coding will be something like this:
Code:
@echo off
color 1f
title Zipper Unzipper by alokbina
echo.
echo Please select one of the following options you want to do :
echo.
echo 1.Unzip/Extract zip file.
echo 2.Compress/Zip/Archieve files and folders.
echo x.Exit
echo.
set /p se=Select your decision
if %se%==1 (goto unzip)
if %se%==2 (goto zip)
if %se%==x (goto exit)
:unzip
cls
echo.
echo Please place the zip file, i.e. the zip you want to extract in /EXTRACT/INPUT directory.
echo.
pause
echo Extracting...
echo.
mkdir %cd%\EXTRACT\OUT
if exist "%cd%\EXTRACT\INPUT\*.zip" (call %cd%\zip\7za.exe x "%cd%\EXTRACT\INPUT\*" -o"%cd%\EXTRACT\OUT")
echo All done! Congrats. You can find the extracted files in /EXTRACT/OUT directory.
echo.
pause
goto exit
:exit
exit
Now you can successfully share your tool.
Note-You can practically change all the text written after : (the colon) but make sure to edit the goto command in the same way.
Dont forget to hit THANKS
Re: [HOW-TO] Make your own zipping and extracting tool.
Great guide.
But Wait a sec,
can't this guide be expanded to make any one_click tools as batch? You could practically make any other tool if you know the basics, right. So why not add it too?:thumbup:
Hope I don't sound too pushy
Re: [HOW-TO] Make your own zipping and extracting tool.
mnishamk said:
Great guide.
But Wait a sec,
can't this guide be expanded to make any one_click tools as batch? You could practically make any other tool if you know the basics, right. So why not add it too?:thumbup:
Hope I don't sound too pushy
Click to expand...
Click to collapse
There's already a guide by erasate on it
Press THANKS if I helped,
Best Regards,
AJ
Dont miss the ICON FARM!

How to create your own one click recovery installer for any android device

Today most of us use one click softwares to work with our android phones or tablets.
Ever wondered how these work ??
If,yes today i will teach you how to make your own "one click custom recovery for your phone". :good:
Before we begin we need a few requirements. The basic things include
TWRP image for your phone
You can download the image for your phone by clicking here
Notepad or any other similar software installed on your pc
Some knowledge on creating a ".bat" file
and a device with unlocked bootloader
Once you have this lets get started.
First download and extract the "Recovery files.zip" from the attachments
How to make a one click recovery
After downloading copy the twrp image to this folder.
Now,Create a new text file and write the following commands.
Before that let us understand some basic bat file commands.
The word "echo" is used to add lines in bat file. If u want to add blank lines just type "echo." and to add text or any other symbols type "echo <your text> " Make sure you leave a space after echo and eliminate the"<>" symbols.
To change the default colour,type "color 0a". You can try changing "a" with "b","c" etc to see new colours.
The "pause" Command is used to view the message "Press any key to continue",
The "cls" command clear the entire window and execute the lines just after the cls command.
The "exit" to close the bat file.
I think thats enough for a begginer.If you have any doubts ask in comments not in pm.
So first type these commands in the text file you created
Code:
@echo off
COLOR 0b
Title <YOUR TITLE FOR THE SOFTWARE>
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo One Click TWRP Recovery Installer for <DEVICE NAME>
echo -- TWRP Recovery image by <YOUR NAME>--
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo One Click Installer made by [url]www.YOUR[/url] WEB SITE.com
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo <any thing you like to display>
pause
cls
The pause is given to promt the user to press any key to continue
The "cls" to clear all the details printed after the key is pressed.
If you want to add blank lines type "echo." and hit enter.
Code:
adb devices
adb reboot bootloader
fastboot devices
fastboot erase cache
fastboot flash recovery [COLOR="Orange"]recovery file name[/COLOR].img
echo -----------------------------------------------------------
echo -----------------------------------------------------------
echo Installation successful!
echo Your device will now reboot automatically.
echo -----------------------------------------------------------
echo -----------------------------------------------------------
fastboot reboot
echo to close this window press any key..
pause
exit
I hope you may have some knowledge about the adb commands,so that i dont need to explain those again.
Once this is done save the file as "filename.bat" and save type to "All Files" from "Text Document".
Once agin to keep in mind this requires a phone with Unlocked bootloader and Make sure that "USB Debugging is enabled"
You can see the bat file i created with above codes and the text file i wrote in the attachment
If this helped you post you reply and thumbs up :laugh:
Great but please use "[ CODE][/ CODE]" to format the code parts in your text (like the following example). And take another look, there are some Typos.
Code:
This is how it looks formatted as code!
Keep it going
Deletescape
deletescape said:
Great but please use "[ CODE][/ CODE]" to format the code parts in your text (like the following example). And take another look, there are some Typos.
Code:
This is how it looks formatted as code!
Keep it going
Deletescape
Click to expand...
Click to collapse
Yeah thanks for the info. I will look into that today itself
Thanks
Ty, very useful.
caes95 said:
Ty, very useful.
Click to expand...
Click to collapse
you are
welcome
adithyan25 said:
Yeah thanks for the info. I will look into that today itself
Click to expand...
Click to collapse
I have changed as you suggested :victory:

[Hack] Skip WiFi setup/ Setup wizard while booting Android for first time.

Hey guys,
We had plenty of sweet surprises for Mi 4i recently, especially considering the Nougat ROMs. This also implies that you'll be busy in flashing a plenty of times.
You should also have noticed by now that when you flash a new ROM, you can't entirely Skip the network connection requirement after the first boot. This annoyed me so much because I have a slow, conservative bandwidth.
Fortunately, I have found a solution; but make no mistake, I'm NOT the author of this solution. This method was originally for Nexus 7 by organophosphate. I'm just extending this amazing trick to Mi 4i.
If you want, you can read the original post.
What do you need?
PC
Your phone
TWRP recovery
ADB on PC
Have them all before proceeding.
Procedure :
1. After installing your ROM through TWRP, mount system partition(Advanced>Mount>check system).
2. Connect your phone to PC via USB. Let the phone be in recovery. All the work is to be done in the same.
3. Launch ADB. Just ensure proper connection by first using adb usb and then adb devices commands. It should then show your phone connected in recovery mode.
4. Now, the important part.
If you want to skip only the WiFi setup part but not the rest of initial setup, execute adb shell sed -i 's/ro.setupwizard.wifi_required=true/ro.setupwizard.wifi_required=false/g' /system/build.prop
If you want to skip entire setup and directly goto home screen, launch Shell by executing adb shell and then execute the command echo "ro.setupwizard.mode=DISABLED" >> /system/build.prop.
5. Reboot your phone, either by using adb reboot (or just reboot in Shell) or using Reboot option in recovery.
6. Now, you should see a Skip button in WiFi setup page or Home screen depending on your choice in step 4.
7. Enjoy/explore your new OS
Few personal notes:
1. Entire procedure should happen while your phone is in recovery mode.
2. Skipping the setup wizard entirely has more working chance(almost every time) than skipping just WiFi setup. Skipping WiFi setup rarely worked for me. So, I'd recommend the former option.
3. Skipping initial setup entirely won't cause any trouble as it just for collecting the very basic information. Those details can be set manually later.
5. This method won't cause any trouble usually. That said, I'm not responsible for bootloops(although I haven't encountered it yet). This is not to discourage you but to let you know of worst case scenario. Should this happen, please refer to original article mentioned earlier.
Credits :
organophosphate for this amazing hack.
I(yourSAS) may/may not deserve credit for extending the method and sharing, depending on your result
or extractt he flashable zip
edit the build.prop
re pack it again and flash?
faizauthar12 said:
or extractt he flashable zip
edit the build.prop
re pack it again and flash?
Click to expand...
Click to collapse
I guess that would work. But it'll be lengthy and tedious.
If devs test and do that before releasing the ROM, this problem will be no more.
faizauthar12 said:
or extractt he flashable zip
edit the build.prop
re pack it again and flash?
Click to expand...
Click to collapse
In that case what lines should I delete/edit ?
elonmusk said:
In that case what lines should I delete/edit ?
Click to expand...
Click to collapse
oopss, we don't need to do this trick anymore
lineage already fix ( patch ) the setup wizard, it will ask a Wi-Fi connection..
so make sure you're an up-to date build
faizauthar12 said:
oopss, we don't need to do this trick anymore
lineage already fix ( patch ) the setup wizard, it will ask a Wi-Fi connection..
so make sure you're an up-to date build
Click to expand...
Click to collapse
Yes! I'm on the latest version.. was just curious..
elonmusk said:
Yes! I'm on the latest version.. was just curious..
Click to expand...
Click to collapse
It is already explained in first post. Those two are basic Linux commands:
- echo - is a simple command line text files editor/creator
Code:
echo "ro.setupwizard.mode=DISABLED" >> /system/build.prop
It mean: append text string "ro.setupwizard.mode=DISABLED" to the end of text file "/system/build.prop" , so if you want to do manually these unpack/repack acrobation, just paste "ro.setupwizard.mode=DISABLED" in build .prop
- sed - is advanced command line text editor, you can change already existing text in text file with your desired, using exact match or regex, etc.
Code:
sed -i 's/ro.setupwizard.wifi_required=true/ro.setupwizard.wifi_required=false/g' /system/build.prop
It mean: Get text file "/system/build.prop" , find in file following text string "ro.setupwizard.wifi_required=true" and change it to "ro.setupwizard.wifi_required=false", so if you want to do manually unpack/repack acrobations, just change true to false in mentioned text string, in build.prop.
Anyway, thanks to @yourSAS for sharing idea
Skip WiFi Setup / Setup Wizard On Fresh Boot
Figured I would leave my notes here as this where google dropped me off...
Yes ro.setupwizard.wifi_required doesn't work as expected most of the time as it was replaced with ro.setupwizard.require_network.
That being said one should be using it to skip WiFi setup:
adb shell sed -i 's/ro.setupwizard.require_network=any/ro.setupwizard.require_network=no/g' /system/build.prop
Click to expand...
Click to collapse
None the less here is a little breakdown of the process with a few suggestions:
1. Boot to TWRP.
2. Mount System partition.
3. Pull current build.prop to see what is currently set.
--- There may be other possible values for these properties.
--- There are many other things one can change from here, google them.
--- Also you may find that once mounted the build.prop resides in /system/system rather.
4. Run commands.
5. Reboot, Profit!
# Pull current build.prop from phone to local folder; see what you currently have.
adb pull /system/build.prop
# Push build.prop back to device.
# You can use this method, just be sure you save your the text file with correct line endings for Linux (no CR only LF).
# Using commands to edit the file rather than a pull/push will ensure things stay the same.
adb push /system.build.prop
# Replace elements in text files (build.prop).
adb shell sed -i 's/FIND.THIS/REPLACE.WITH.THIS/g' /system/build.prop
# Append (add a new line) to text file.
echo "NEW LINE TO ADD" >> /system/build.prop
# Relevant properties
# Set which, or if any network is required
ro.setupwizard.require_network=
any, no, wifi
# Same as above but older property
ro.setupwizard.network_required=
true, false
# Again replaced by above
ro.setupwizard.wifi_required=
true, false
# Control the complete setup process
ro.setupwizard.mode=
OPTIONAL, ENABLED, DISABLED
Click to expand...
Click to collapse

Categories

Resources