我修改了这篇文章,以反映根据回复建议所做的更改。
我想在一个批处理文件中运行几行adb命令。
my_results =[]
for f in file:
#do some stuff
if score >= 0:
my_results.append(str(score))
print my_result
我面临的问题是以下错误: “错误:设备'(null)'未找到”
我知道我输入的IP地址是正确的。实际上,我可以通过在单独的命令提示符中输入命令来轻松访问FireStick。
即。 adb connect 192.168.0.164
为什么它在这里不起作用?
即使我将脚本修改为以下内容:
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
我收到错误,显示IPInput未用于设置IP地址。输出显示:
192.168.0.:5555
是什么给出了?
答案 0 :(得分:0)
您正在尝试在批处理文件中使用VBScript代码。这不会起作用¹。在批处理中,您可以通过set
命令提示用户输入:
echo Find the IP of the FireStick; Go to Settings, System, About, Network
set /p IPInput=Enter the IP address:
¹除非你正在制作某种Frankenscript,我强烈建议不这样做。
答案 1 :(得分: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