Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

能否采用以下bat文件,可以实现电脑自动检测并打开app,简化操作步骤,在电脑上只需打开bat文件,剩下的可以完全在手机上操作 #68

Open
jerry-official opened this issue Jan 9, 2025 · 1 comment

Comments

@jerry-official
Copy link

@echo off
:: 检查是否有设备连接,清除多余输出
adb devices >nul 2>&1

:: 检查指定的应用是否已经在运行
for /f "tokens=1" %%i in ('adb shell pidof top.weixiansen574.hybridfilexfer') do set app_pid=%%i

:: 如果应用已在运行,跳过启动应用步骤
if defined app_pid (
echo 应用已在运行,跳过启动...
) else (
echo 设备已连接,尝试启动app...
adb shell am start -n top.weixiansen574.hybridfilexfer/.MainActivity
echo 已启动app
)
:restart_jar
java -jar HybridFileXfer.jar -c adb
echo 请在手机上取消勾选移动网络的端口,并启动服务器。尝试检测中...
timeout /t 1 >nul 2>&1
goto restart_jar

@cute-omega
Copy link

不如更进一步,开启无线ADB调试然后就可以在不连线的情况下自动打开并连接?(笑,顺便这种情况下设备间有ADB但由于ADB本身跑在无线上所以也许adb不要作为传输网卡?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants