Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何使用方便的BAT文件通过WiFi*连接到adb*_Android_Debugging_Batch File_Wifi_Adb - Fatal编程技术网

Android 如何使用方便的BAT文件通过WiFi*连接到adb*

Android 如何使用方便的BAT文件通过WiFi*连接到adb*,android,debugging,batch-file,wifi,adb,Android,Debugging,Batch File,Wifi,Adb,我试图找到一种方法,通过WiFi连接到我的android。。在StackOverflow上找到了一些,但每次我想连接android时都需要转到cmd。。所以我想出了一个bat文件 见下文我找到了一些通过Stackoverflow上的WiFi连接到设备的好方法。。但是每次你想连接的时候,他们都需要去cmd,这对我来说很不方便 因此,我花了一些时间创建了一个bat文件,只需单击一下,您就可以通过WiFI将android连接到adb 您只需将defaultIp和adbLoc设置为设备的IP,将adbL

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


见下文

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

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

您只需将defaultIp和adbLoc设置为设备的IP,将adbLoc设置为adb的位置(sdk\platform tools)

我不得不

注 您的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,如桌面)


抱歉,如果bat太糟糕了,我的第一个方法之一是在Stackoverflow上找到一些不错的方法通过WiFi连接到您的设备。。但是每次你想连接的时候,他们都需要去cmd,这对我来说很不方便

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

您只需将defaultIp和adbLoc设置为设备的IP,将adbLoc设置为adb的位置(sdk\platform tools)

我不得不

注 您的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,如桌面)


抱歉,如果bat很糟糕,我的第一个问题之一是,我尝试重新连接它时遇到了问题,因为我中断了adb流程,但它失败了。。我已经在bat中添加了“adb tcpip 5555”,到目前为止,这已经解决了我试图重新连接它的问题,因为我中断了adb流程,但它失败了。。我已经在bat中添加了“adb tcpip 5555”,到目前为止已经修复了它
@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" %=%