adb的批处理脚本

时间:2016-10-11 23:33:08

标签: android batch-file adb

我已经编写了一个adb无线连接脚本,嵌套if else但是我不知道它没有正确执行的问题代码是什么 对于每个输入,都有相同的输出 批处理是否支持“嵌套if else”,如果是,那么请告诉我 我做错了什么。有任何语法错误。 请帮帮我

@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 个答案:

没有答案