diff --git a/Windows/Scripts/ATA.bat b/Windows/Scripts/ATA.bat index 587be9c..ab02382 100644 --- a/Windows/Scripts/ATA.bat +++ b/Windows/Scripts/ATA.bat @@ -315,37 +315,14 @@ pause cls goto :disclaimer -:adbwlan -adb devices -adb shell ip route -echo Write the ip that you will find at the end -SET /P adbwlanvar=Enter device ip: -adb tcpip 5555 -for /f "delims=" %%v in ('adb connect %adbwlanvar%') do set "devicewlanstatus=%%v" -if "%devicewlanstatus%"=="connected to %adbwlanvar%:5555" ( - echo Done! - echo now you can detach the cable from your smartphone, you can only use system commands via WLAN - set adbwlanstatus="connected to %adbwlanvar%:5555" - echo %adbwlanvar% > deviceip.tmp -) else ( - echo Failed! -) -pause -goto :adbnetworkmenu :menu -if exist deviceip.tmp ( - for /f "delims= " %%a in (deviceip.tmp) do ( set adbwlanvar=%%a ) -) -for /f "delims=" %%v in ('adb connect %adbwlanvar%') do set "devicewlanstatus=%%v" -if "%devicewlanstatus%"=="connected to %adbwlanvar%:5555" ( +set errorlevelaon=1 +adb connect %adbwlanvar% | findstr "%adbwlanvar%:5555" && if %ERRORLEVEL%==0 set errorlevelaon=0 +if %errorlevelaon%==0 ( set adbwlanstatus=connected to %adbwlanvar%:5555 ) else ( - if exist deviceip.tmp ( - set /p adbwlanstatus=nul && pause && set "adbwlanvar=" && goto devicecheck -goto adbnetworkmenu +adb shell ip route +SET /P inputanmvar=Enter ip displayed: +adb disconnect %inputanmvar% | findstr "disconnect" && if %ERRORLEVEL%==0 set errorlevelaon=0 +if %errorlevelaon%==0 ( + pause + set adbwlanvar="" + set adbwlanstatus=Error! Any device connected/found + goto devicecheck +) else ( + echo Error! + goto adbnetworkmenu +) + +:adbwlan +set errorlevelaon=1 +adb devices +adb shell ip route +echo Write the ip that you will find at the end +SET /P adbwlanvar=Enter device ip: +adb tcpip 5555 +adb connect %adbwlanvar% | findstr "%adbwlanvar%:5555" && if %ERRORLEVEL%==0 set errorlevelaon=0 +if %errorlevelaon%==0 ( + echo Done! + echo now you can detach the cable from your smartphone, you can only use system commands via WLAN + set adbwlanstatus=connected to %adbwlanvar%:5555 +) else ( + echo Failed! + set adbwlanstatus=Error! Any device connected/found +) +pause +goto :adbnetworkmenu :menubootloader cls @@ -835,14 +842,21 @@ call "Banners/banner1.bat" echo The ADB.exe is still running, Do you want to kill it? (Y/n) SET /P inputex=Please Select: if %inputex%==Y ( - adb disconnect %ipaddr%:%port%>nul + if DEFINED adbwlanvar ( + adb disconnect %adbwlanvar% + ) + if DEFINED ipaddr ( + adb disconnect %ipaddr%:%port% + ) taskkill /f /im adb.exe + del deviceip.tmp echo Done! goto :exitstatus ) if %inputex%==y ( adb disconnect %ipaddr%:%port%>nul taskkill /f /im adb.exe + del deviceip.tmp echo Done! goto :exitstatus )