1 Star 4 Fork 2

Vahagn/scrcpyoh

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
launch.bat 1.86 KB
一键复制 编辑 原始数据 按行查看 历史
Vahagn Ghazaryan 提交于 2024-10-11 13:40 . keyboard functionalites
@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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ghazariann/scrcpyoh.git
git@gitee.com:ghazariann/scrcpyoh.git
ghazariann
scrcpyoh
scrcpyoh
master

搜索帮助