我试图找到一种方法将Via WiFi连接到我的android ..在StackOverflow上找到了一些但是每次我想要连接我的android都需要去cmd ..所以我想出了一个bat文件< / p>
见下文
答案 0 :(得分:3)
我发现了一些很好的方法可以通过Stackoverflow上的WiFi连接到你的设备..但是每次你想要连接它们都需要去cmd这对我来说很不方便..
所以我花了一些时间创建了一个bat文件,只需点击一下就可以通过WiFI将你的android连接到adb
您需要做的就是将defaultIp AND 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非root 我还为防火墙添加了端口5555的例外
Declatations:
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
实际蝙蝠文件(将其保存为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" %=%
对不起,如果蝙蝠很糟糕,我的第一个