1

我试图找到一种通过 WiFi 连接到我的 android 的方法。在 StackOverflow 上找到了一些,但每次我想连接我的 android 时它们都需要进入 cmd 。所以我想出了一个 bat 文件

见下文

4

1 回答 1

4

我在 Stackoverflow 上找到了一些通过 WiFi 连接到您的设备的好方法。但是每次您想连接时,它们都需要进入 cmd,这对我来说很不方便。

所以我花了一些时间创建了一个 bat 文件,只需单击一下,您就可以通过 WiFI 将您的 android 连接到 adb

您需要做的就是将 defaultIp 和 adbLoc 设置为设备的 IP,并将 adbLoc 设置为 adb 的位置(sdk\platform-tools)

TO USE THIS YOU MUST INITIALLY HAVE YOUR ANDROID CONNECTED VIA USB

好吧,我不得不...

笔记

您的 android 必须首先通过 USB 连接才能使用 TCP/IP 进行连接 我的测试已经完成,并且 Galaxy Tab 2 10.1 无根 我还在我的防火墙中添加了端口 5555 的例外

声明:

defaultIp                 == the IP of your android
adbLoc                    == where the adb.exe is located for the sdk
enableSetVariablesWarning == Show the initial warning?
askForIP                  == If your android has a dynamic ip you might have
...                          to set this to true, else set to false

实际的 Bat 文件(将其另存为 startAdbWifi.bat,如桌面)

@echo off

:: This is one of my First bat's so sorry if it's terrible

:: Initilisation of Variables.. Put your defualts in here
:: Change enableSetVariablesWarning to anything else to
:: disable warning
set defaultIp="SET ME"
set adbLoc="SET ME"
set enableSetVariablesWarning="true"
set askForIP="true"
:: End of Initiation

if /I %enableSetVariablesWarning%=="true" GOTO COMMENT
GOTO ENDOFCOMMENTS
:COMMENT
@echo 01010101010101010101010101 CONFIG 01010101010101010101010101
@echo Is This your first time using this bat?
@echo make sure that you have configured:
@echo defaultIp: %defaultIp%
@echo adbLoc: %adbLoc%
@echo askForIP: %askForIP%
@echo change "enableSetVariablesWarning" to anything other than
@echo true to disable this warning
@echo 01010101010101010101010101 CONFIG 01010101010101010101010101
@echo.
:ENDOFCOMMENTS

@echo Make sure that the Android is connected

if /I %askForIP%=="true" GOTO GETIP
set ip=%defaultIp%
GOTO CONNECT

:GETIP
set ip="invalid"
set /p ip="Enter IP(default=192.168.1.75): " %=%
if /I %ip%=="invalid" GOTO SETIP
GOTO CONNECT
:SETIP
set ip=%defaultIp%
@echo Defaulting the ip to: %ip%


:CONNECT
set curr_dir=%cd%

chdir /D %adbLoc%
@echo Restarting adb
adb kill-server


adb tcpip 5555
adb connect %ip%
adb devices
chdir /D %curr_dir%

set /p ip="Press Enter to Exit" %=%

对不起,如果蝙蝠很糟糕,我的第一个

于 2013-05-29T09:45:24.600 回答