【问题标题】:How to use more than one command in dos loop如何在dos循环中使用多个命令
【发布时间】:2018-04-06 08:37:40
【问题描述】:

我试图在 dos 脚本 .bat 中调用 for-loop 中的两个命令。第二个命令被忽略。它只是在控制台中显示,什么都不做。我一直在寻找更多for-loop 示例,但没有成功。

:loop
FOR /L %%i IN (1,1,500) do (
    REM command number 1
    adb wait-for-device shell input touchscreen swipe 1400 800 200 800 1000
    REM command number 2    
    adb wait-for-device shell input touchscreen swipe 800 1400 200 800 1000
)
goto loop

【问题讨论】:

  • 这些行 #command number ... 实际上是您的批处理文件的一部分,还是您只是在此处添加它们以进行说明?
  • 有两个以“adb”开头的命令,我用#作为注释什么是什么
  • # 字符并不表示批处理文件中的注释。
  • 更改为REM

标签: windows batch-file for-loop cmd


【解决方案1】:

你可以试试这个,

:loop
FOR /L %%i IN (1,1,500) do (
goto loop
)

:commands
#command number 1
adb wait-for-device shell input touchscreen swipe 1400 800 200 800 1000
#command number 2    
adb wait-for-device shell input touchscreen swipe 800 1400 200 800 1000
goto loop

我不是批处理文件方面的专家,我只是在典型的编程方面表现不错,所以有些事情可能需要修复,但这里有一个想法。

【讨论】:

    猜你喜欢
    • 2011-10-23
    • 1970-01-01
    • 1970-01-01
    • 2015-07-09
    • 2017-03-09
    • 1970-01-01
    • 2012-06-16
    • 2023-03-20
    • 1970-01-01
    相关资源
    最近更新 更多