【问题标题】:Batch Loop %Variable% times批处理循环 %Variable% 次
【发布时间】:2017-11-19 12:27:19
【问题描述】:

我正在创建一个批处理文件,以便使用 ADB 轻松控制我的手机

我已经完成了大部分工作,但是我希望能够控制我的音量。

我知道adb shell input keyevent 25 减少了 1 级,但是有没有办法使用变量来执行 x 次?

所以,我目前有:

cd C:\platform-tools-latest-windows\platform-tools
cls
title DECREASING Volume
cls
echo Decreasing Volume...
adb shell input keyevent 25
pause
cls
goto :USERAREA

如果我要问用户要减少多少级,我会从:

cd C:\platform-tools-latest-windows\platform-tools
cls
title DECREASE Volume
cls
set /p VOL=How many levels should it decrease by: 
pause
echo Decreasing Volume...
adb shell input keyevent 25
pause
cls
goto :USERAREA

但是,我不知道如何重复命令adb shell input keyevent 25 %VOL% 次数。

请帮帮我,

谢谢

yg.swagness

【问题讨论】:

    标签: android shell batch-file


    【解决方案1】:
    for /L %%a in (1,1,%vol%) do adb shell input keyevent 25
    

    在文档提示中查看for /?

    【讨论】:

    • 非常感谢@Magoo,我赞成并接受了你的回答
    猜你喜欢
    • 2019-08-06
    • 2017-06-15
    • 2019-01-26
    • 2014-02-21
    • 1970-01-01
    • 2011-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多