Batch Files - Quick Reference Guide
info
Ensure you have admin privileges when running batch scripts that interact with ADB.
๐ Conditional Branchingโ
if %WIFI_CONNECTED% EQU 1 (
goto MDM_JOIGNABLE
)
๐ Menu Selectionโ
| Option | Action |
|---|---|
| 1 | OS ADB Update |
| 2 | OS OTA Update |
| 3 | Install Master |
| 4 | Exit |
set /p choix=Enter your choice (1,2,3 or 4) :
if /I "%choix%"=="1" (goto :OS)
if /I "%choix%"=="2" (goto :OSOTA)
if /I "%choix%"=="3" (goto :MASTER)
if /I "%choix%"=="4" (goto :FIN)
goto question0
๐งญ GOTO Usageโ
goto :label
๐ Search and Replace in Filesโ
powershell -Command "(gc config.ini) -replace 'USER01', '%username%' | Out-File config.ini" -encoding ASCII
๐งผ Clear Memory (Kill App Stacks)โ
for /F "tokens=1,2,3,4" %%i in ('%adb% shell "am stack list | findstr \"Stack id\" "') do (
call :idstackcleaner "%%j"
)
:idstackcleaner
set id=%~1
set id2=%id:~3%
if %id2% NEQ 0 (
%adb% shell am stack remove %id2%
)
goto :eof