-1

我修改了这篇文章以反映根据回复建议所做的更改。

我想在一个批处理文件中运行几行 adb 命令。

cd C:\Users\James\AppData\Local\Android\sdk\platform-tools
adb kill-server
adb start-server 

timeout 5
echo Find the IP of the FireStick; Go to Settings, System, About, Network
set /p IPInput = Enter the IP address: 

adb connect %IPInput%
::Error after this line, I am told "error: device '(null)' not found"

adb install "C:\Users\James\Desktop\Kodi on FIreStick\kodi-16.1-Jarvis-armeabi-v7a.apk"
adb install "C:\Users\James\Desktop\Kodi on FIreStick\ace-stream-media-beta-3-1-6-0-apkplz.com.apk"
adb install "C:\Users\James\Desktop\Kodi on FIreStick\Emulators\NES\com.androidemu.nes_61.apk"
adb install "C:\Users\James\Desktop\Kodi on FIreStick\Emulators\SNES\snes9x-ex-1-5-28-en-android.apk"

adb push C:\00_kodi_userdata /sdcard/Android/data/org.xbmc.kodi/files/.kodi/userdata/
adb push C:\00_kodi_addons /sdcard/Android/data/org.xbmc.kodi/files/.kodi/addons/

adb push "C:\00_kodi_downloads" /sdcard/Download

我面临的问题是以下错误:“错误:找不到设备'(null)'”

我知道我输入的 IP 地址是正确的。事实上,我可以通过在单独的命令提示符中输入命令轻松访问 FireStick。

即 adb 连接 192.168.0.164

为什么它在这里不起作用?

即使我将脚本修改为以下内容:

echo Find the IP of the FireStick; Go to Settings, System, About, Network
set /p IPInput = Enter the last three values of the IP address: 

adb connect 192.168.0.%IPInput%

我收到一个错误,显示 IPInput 未用于设置 IP 地址。输出只显示:

192.168.0.:5555

是什么赋予了?

4

2 回答 2

0

对于那些偶然发现这一点的人。

命令:

set /p IPInput = Enter the IP address:

等号前后不得包含空格。如下所示:

set /p IPInput=Enter the IP address:

然后,您可以使用以下命令:

adb connect %IPInput%:5555

连接到 FireStick

我将连接到 FireStick 的代码的上半部分(假设 adb 及其组成部分在您的路径中)如下:

cd %~d0\FireStickAutomation
adb kill-server
adb start-server 

timeout 5

@echo off
echo.
echo.
echo .. READ ME .. 
echo.
echo.
echo Find the IP of the FireStick; Go to Settings, System, About, Network
echo.
echo.
echo Make note of the entire string
echo.
echo.
set /p IPInput=Enter the IP address including the dots:
echo.
echo.

adb connect %IPInput%:5555
于 2016-08-28T22:53:49.067 回答
0

您正在尝试在批处理文件中使用 VBScript 代码。那是行不通的¹。在批处理中,您可以通过以下命令提示用户输入set

echo Find the IP of the FireStick; Go to Settings, System, About, Network
set /p IPInput=Enter the IP address: 

¹ 除非您正在构建某种 Frankenscript,我强烈建议您要这样做。

于 2016-08-28T16:09:52.413 回答