无法adb拉入批处理文件“for / f”

时间:2016-08-09 15:57:39

标签: android batch-file adb

我正在尝试设置批处理文件以在多个用户配置文件中搜索日志文件。它似乎没有问题地找到文件,adb pull失败并出现错误。

:批处理

@echo off

echo.
echo checking files
adb shell ls -d $PWD /data/user/*/com.myap/app_log/*.log
echo.

echo copying files
for /f "skip=1" %%a in ('adb shell ls -d $PWD/data/user/*/com.myapp/app_log/*.log') do (
echo values are %%a 
adb pull %%a
)

结果:

checking files
//data/user/0/com.myapp/app_log/2016-08-09.log
//data/user/10/com.myapp/app_log/2016-08-09.log

copying files
 Values are //data/user/10/com.myapp/app_log/2016-08-09.log
' does not exist/data/user/10/com.myapp/app_log/2016-08-09.log
Press any key to continue . . .

如果我运行以下没有变量,它可以正常工作

adb pull //data/user/10/com.myapp/app_log/2016-08-09.log
1738 KB/s (81920 bytes in 0.046s)

这有效但当ls返回多个文件时不会工作

echo copying files
for /f "skip=1" %%a in ('adb shell ls -d $PWD /data/user/*/com.blackberry.enterprise.bscp/app_log/*.log') do set path=%%a
echo %path%
adb pull %path%

0 个答案:

没有答案