代码拉取完成,页面将自动刷新
@echo off
setlocal
REM Allow external specification of device_key
set device_key=%1
REM Validate if device_key is empty or over 35 characters, else retrieve from hdc list targets
if "%device_key%" == "" (
echo No device key specified. Checking for device via hdc...
for /f %%i in ('hdc list targets') do (set device_key=%%i)
) else (
if not "%device_key%"=="" if not "%device_key:~35%"=="" (
echo Error: Device key exceeds 35 characters or is empty.
pause
exit /b 1
)
)
REM Check if device_key is still empty or invalid after fallback
if "%device_key%" == "" (
echo Error: No valid device key found.
pause
exit /b 1
)
echo Checking for %SERVER_BINARY%...
set SERVER_BINARY=scrcpyoh_server
if not exist %SERVER_BINARY% (
echo %SERVER_BINARY% not found.
pause
exit /b 1
)
echo Checking hdc command...
where hdc >nul 2>nul
if not %ERRORLEVEL% == 0 (
echo hdc command not found.
pause
exit /b 1
)
REM Check if device is properly listed
if "%device_key%" == "[Empty]" (
echo No valid hdc device found.
pause
exit /b 1
)
echo Killing running server and deleting the file...
hdc -t %device_key% shell "pkill -9 %SERVER_BINARY%"
hdc -t %device_key% shell "rm -f /data/tmp/%SERVER_BINARY%"
echo Sending %SERVER_BINARY% file to target device...
hdc -t %device_key% shell "mkdir -p /data/tmp"
hdc -t %device_key% file send %SERVER_BINARY% /data/tmp/%SERVER_BINARY%
hdc -t %device_key% shell "chmod +x /data/tmp/%SERVER_BINARY%"
echo Starting %SERVER_BINARY% and setting forward proxy...
hdc -t %device_key% shell "/data/tmp/%SERVER_BINARY% >/dev/null 2>&1 &"
hdc -t %device_key% fport tcp:8000 tcp:8000
echo Waiting 1s for the server to be ready...
timeout /t 1 >nul
echo Starting client...
python3 ./client/main.py
echo Removing forward proxy...
hdc -t %device_key% fport rm tcp:8000 tcp:8000
pause
endlocal
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。