batch script for adb over wifi

2019-06-14 07:07发布

I have written a script for adb wireless connection with a nested if else but and i don't know what is the problem code it not executing properly for every input there is same output does batch supports "nested if else " or not if yes then then please tell me what i am doing wrong. is there any syntax error. please help me

@echo off
:getip
set ip=""
set /p ip=[-]  Please Enter IP Address :
echo.
if %ip%=="" echo      Please Enter Correct Ip & pause >nul & cls & goto getip
goto wireless
:wireless
setlocal
adb kill-server
::connected
adb connect %IP%:5555 | find /i "connected to" >nul
    if errorlevel 1 (

         ::laptop wifi off 
         adb connect %IP%:5555 | find /i "unreachable host" >nul
             if errorlevel 1 (

                :: Wrong Ip format
                adb connect %IP%:5555 | find /i "no such host" >nul
                    if errorlevel 1 (

                        ::5555 port off
                        adb connect %IP%:5555 | find /i "refused it" >nul
                            if errorlevel 1 (

                                :: Android Wifi Off
                                adb connect %IP%:5555 | find /i "faild to respond" >nul
                                    if errorlevel 1 (
                                        echo.
                                        echo   Unknown Error & pause >nul & goto getip
                                     )
                                    else(
                                         echo. & echo  Could Not connect To Given IP
                                         echo. & echo  Reason Can Be...
                                         echo. & echo  Android Is Not connected To Local Wifi
                                         echo. & echo  Or No Device With This Ip In LAN & echo >nul & goto getip
                                         )

                              )
                            else(
                                echo. & echo Android Wireless Port Is Off
                                echo. & echo Press Any Key To Turn On & pause >nul & goto adbport
                                )

                      )
                    else(
                        echo. & echo  Wrong Format IP Address...
                        echo. & echo  Please Enter IP In Given Format Example "192.168.10.10"
                        echo. & echo  Press Any Key To Continue.... & goto getip
                        )

               )
             else(
                 echo. & echo laptop/Desktop Wifi IS Off Or Not connected To Local Wifi/LAN
                 echo. & echo connect laptop/Desktop To The LAN. & echo. & echo pause >nul
                 echo Press Any Key To Go Back & goto getip
                 )
      )      
    else(
        cls
        echo. & echo        Android Hacker Is connected With The Victim's Device Wirelessly.
        echo        Now You Can Remove The USB & echo.
        echo        Press Any Key To Continue To Menu 2 & pause >nul & goto menu2
    )  


[-]  Please Enter IP Address :192.168.10.4

'else' is not recognized as an internal or external command,
operable program or batch file.

 Wrong Format IP Address...

 Please Enter IP In Given Format Example "192.168.10.10"

 Press Any Key To Continue....
[-]  Please Enter IP Address :

0条回答
登录 后发表回答